mirror of
https://github.com/Wan-Video/Wan2.1.git
synced 2025-11-05 06:29:14 +00:00
improve styling
This commit is contained in:
parent
3d9f4c4326
commit
306229c17f
@ -24,7 +24,7 @@ import asyncio
|
|||||||
from wan.utils import prompt_parser
|
from wan.utils import prompt_parser
|
||||||
PROMPT_VARS_MAX = 10
|
PROMPT_VARS_MAX = 10
|
||||||
|
|
||||||
target_mmgp_version = "3.3.0"
|
target_mmgp_version = "3.3.1"
|
||||||
from importlib.metadata import version
|
from importlib.metadata import version
|
||||||
mmgp_version = version("mmgp")
|
mmgp_version = version("mmgp")
|
||||||
if mmgp_version != target_mmgp_version:
|
if mmgp_version != target_mmgp_version:
|
||||||
@ -39,6 +39,17 @@ tracker_lock = threading.Lock()
|
|||||||
file_list = []
|
file_list = []
|
||||||
last_model_type = None
|
last_model_type = None
|
||||||
|
|
||||||
|
def format_time(seconds):
|
||||||
|
if seconds < 60:
|
||||||
|
return f"{seconds:.1f}s"
|
||||||
|
elif seconds < 3600:
|
||||||
|
minutes = seconds / 60
|
||||||
|
return f"{minutes:.1f}m"
|
||||||
|
else:
|
||||||
|
hours = int(seconds // 3600)
|
||||||
|
minutes = int((seconds % 3600) // 60)
|
||||||
|
return f"{hours}h {minutes}m"
|
||||||
|
|
||||||
def runner():
|
def runner():
|
||||||
global current_task_id
|
global current_task_id
|
||||||
while True:
|
while True:
|
||||||
@ -57,7 +68,7 @@ def runner():
|
|||||||
item.update({
|
item.update({
|
||||||
'progress': f"{((current_step/total_steps)*100 if total_steps > 0 else 0):.1f}%",
|
'progress': f"{((current_step/total_steps)*100 if total_steps > 0 else 0):.1f}%",
|
||||||
'steps': f"{current_step}/{total_steps}",
|
'steps': f"{current_step}/{total_steps}",
|
||||||
'time': f"{elapsed:.1f}s",
|
'time': format_time(elapsed),
|
||||||
'repeats': f"{repeats}",
|
'repeats': f"{repeats}",
|
||||||
'status': f"{status}"
|
'status': f"{status}"
|
||||||
})
|
})
|
||||||
@ -213,14 +224,16 @@ def update_queue_data():
|
|||||||
with lock:
|
with lock:
|
||||||
data = []
|
data = []
|
||||||
for item in queue:
|
for item in queue:
|
||||||
|
truncated_prompt = (item['prompt'][:97] + '...') if len(item['prompt']) > 100 else item['prompt']
|
||||||
|
full_prompt = item['prompt'].replace('"', '"')
|
||||||
|
prompt_cell = f'<span title="{full_prompt}">{truncated_prompt}</span>'
|
||||||
data.append([
|
data.append([
|
||||||
str(item['id']),
|
|
||||||
item.get('status', "Starting"),
|
item.get('status', "Starting"),
|
||||||
item.get('repeats', "0/0"),
|
item.get('repeats', "0/0"),
|
||||||
item.get('progress', "0.0%"),
|
item.get('progress', "0.0%"),
|
||||||
item.get('steps', ''),
|
item.get('steps', ''),
|
||||||
item.get('time', '--'),
|
item.get('time', '--'),
|
||||||
(item['prompt'][:47] + '...') if len(item['prompt']) > 50 else item['prompt'],
|
prompt_cell,
|
||||||
"↑",
|
"↑",
|
||||||
"↓",
|
"↓",
|
||||||
"✖"
|
"✖"
|
||||||
@ -2037,10 +2050,10 @@ def generate_video_tab(image2video=False):
|
|||||||
, columns=[3], rows=[1], object_fit="contain", height=450, selected_index=0, interactive= False)
|
, columns=[3], rows=[1], object_fit="contain", height=450, selected_index=0, interactive= False)
|
||||||
generate_btn = gr.Button("Generate")
|
generate_btn = gr.Button("Generate")
|
||||||
queue_df = gr.DataFrame(
|
queue_df = gr.DataFrame(
|
||||||
headers=["ID", "Status", "Repeats", "Progress", "Steps", "Time", "Prompt", "", "", ""],
|
headers=["Status", "Completed", "Progress", "Steps", "Time", "Prompt", "", "", ""],
|
||||||
datatype=["str", "str", "str", "str", "str", "str", "str", "str", "str", "str"],
|
datatype=["str", "str", "str", "str", "str", "markdown", "str", "str", "str"],
|
||||||
interactive=False,
|
interactive=False,
|
||||||
col_count=(10, "fixed"),
|
col_count=(9, "fixed"),
|
||||||
wrap=True,
|
wrap=True,
|
||||||
value=update_queue_data,
|
value=update_queue_data,
|
||||||
every=1,
|
every=1,
|
||||||
@ -2390,6 +2403,12 @@ def create_demo():
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
}
|
}
|
||||||
|
#queue_df td:nth-child(1) {
|
||||||
|
width: 100px;
|
||||||
|
}
|
||||||
|
#queue_df td:nth-child(6) {
|
||||||
|
width: 300px;
|
||||||
|
}
|
||||||
#queue_df td:nth-child(7),
|
#queue_df td:nth-child(7),
|
||||||
#queue_df td:nth-child(8),
|
#queue_df td:nth-child(8),
|
||||||
#queue_df td:nth-child(9) {
|
#queue_df td:nth-child(9) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user