Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1022,6 +1022,7 @@ with gr.Blocks(title="π MOUSE Workflow", theme=gr.themes.Soft(), css=CSS) as
|
|
| 1022 |
save_status = gr.State("Ready")
|
| 1023 |
|
| 1024 |
# βββ Dynamic Workflow Container βββ
|
|
|
|
| 1025 |
with gr.Column(elem_classes=["workflow-container"]):
|
| 1026 |
# Auto-save status indicator
|
| 1027 |
with gr.Row():
|
|
@@ -1030,8 +1031,9 @@ with gr.Blocks(title="π MOUSE Workflow", theme=gr.themes.Soft(), css=CSS) as
|
|
| 1030 |
|
| 1031 |
@gr.render(inputs=[loaded_data, trigger_update])
|
| 1032 |
def render_workflow(data, trigger):
|
| 1033 |
-
"""
|
| 1034 |
-
|
|
|
|
| 1035 |
workflow_value = data if data else {"nodes": [], "edges": []}
|
| 1036 |
|
| 1037 |
# ---------- Best-AI νλ νΈ ----------
|
|
@@ -1043,10 +1045,10 @@ with gr.Blocks(title="π MOUSE Workflow", theme=gr.themes.Soft(), css=CSS) as
|
|
| 1043 |
"type": "llmNode",
|
| 1044 |
"label": "AI Processing",
|
| 1045 |
"template": {
|
| 1046 |
-
"provider":
|
| 1047 |
-
"model":
|
| 1048 |
-
"temperature":
|
| 1049 |
-
"system_prompt":
|
| 1050 |
}
|
| 1051 |
}
|
| 1052 |
]
|
|
@@ -1058,12 +1060,13 @@ with gr.Blocks(title="π MOUSE Workflow", theme=gr.themes.Soft(), css=CSS) as
|
|
| 1058 |
info="Drag nodes β Connect edges β Edit properties β Auto-save!",
|
| 1059 |
value=workflow_value,
|
| 1060 |
elem_id="main_workflow",
|
| 1061 |
-
custom_palette=best_ai_palette
|
| 1062 |
)
|
| 1063 |
|
| 1064 |
-
|
| 1065 |
def periodic_save(workflow_data):
|
| 1066 |
import json, time, copy
|
|
|
|
| 1067 |
if isinstance(workflow_data, str):
|
| 1068 |
try:
|
| 1069 |
workflow_data = json.loads(workflow_data)
|
|
@@ -1072,25 +1075,27 @@ with gr.Blocks(title="π MOUSE Workflow", theme=gr.themes.Soft(), css=CSS) as
|
|
| 1072 |
ts = time.strftime("%H:%M:%S")
|
| 1073 |
return copy.deepcopy(workflow_data), f"πΎ Auto-save: Saved β ({ts})"
|
| 1074 |
|
| 1075 |
-
|
| 1076 |
wb.change(
|
| 1077 |
fn=periodic_save,
|
| 1078 |
inputs=[wb],
|
| 1079 |
outputs=[loaded_data, save_indicator]
|
| 1080 |
)
|
| 1081 |
|
| 1082 |
-
|
| 1083 |
auto_timer = gr.Timer(5)
|
| 1084 |
auto_timer.tick(
|
| 1085 |
fn=periodic_save,
|
| 1086 |
inputs=[wb],
|
| 1087 |
outputs=[loaded_data, save_indicator]
|
| 1088 |
)
|
| 1089 |
-
|
| 1090 |
|
| 1091 |
return wb
|
| 1092 |
|
| 1093 |
|
|
|
|
|
|
|
| 1094 |
|
| 1095 |
# βββ Import Section βββ
|
| 1096 |
with gr.Accordion("π₯ Import Workflow", open=True):
|
|
|
|
| 1022 |
save_status = gr.State("Ready")
|
| 1023 |
|
| 1024 |
# βββ Dynamic Workflow Container βββ
|
| 1025 |
+
# βββ Dynamic Workflow Container βββ
|
| 1026 |
with gr.Column(elem_classes=["workflow-container"]):
|
| 1027 |
# Auto-save status indicator
|
| 1028 |
with gr.Row():
|
|
|
|
| 1031 |
|
| 1032 |
@gr.render(inputs=[loaded_data, trigger_update])
|
| 1033 |
def render_workflow(data, trigger):
|
| 1034 |
+
"""
|
| 1035 |
+
λμ μΌλ‘ WorkflowBuilder λ λλ§ + 5μ΄ μλ μ μ₯
|
| 1036 |
+
"""
|
| 1037 |
workflow_value = data if data else {"nodes": [], "edges": []}
|
| 1038 |
|
| 1039 |
# ---------- Best-AI νλ νΈ ----------
|
|
|
|
| 1045 |
"type": "llmNode",
|
| 1046 |
"label": "AI Processing",
|
| 1047 |
"template": {
|
| 1048 |
+
"provider": {"value": "VIDraft"},
|
| 1049 |
+
"model": {"value": "Gemma-3-r1984-27B"},
|
| 1050 |
+
"temperature": {"value": 0.7},
|
| 1051 |
+
"system_prompt":{"value": "You are a helpful assistant."}
|
| 1052 |
}
|
| 1053 |
}
|
| 1054 |
]
|
|
|
|
| 1060 |
info="Drag nodes β Connect edges β Edit properties β Auto-save!",
|
| 1061 |
value=workflow_value,
|
| 1062 |
elem_id="main_workflow",
|
| 1063 |
+
custom_palette=best_ai_palette # β νμ¬ λ²μ μμ μ§μλμ§ μμΌλ©΄ μ€λ₯ λ°μ
|
| 1064 |
)
|
| 1065 |
|
| 1066 |
+
# ---------- μ μ₯ λ‘μ§ ----------
|
| 1067 |
def periodic_save(workflow_data):
|
| 1068 |
import json, time, copy
|
| 1069 |
+
# λ¬Έμμ΄ ννλ©΄ νμ±
|
| 1070 |
if isinstance(workflow_data, str):
|
| 1071 |
try:
|
| 1072 |
workflow_data = json.loads(workflow_data)
|
|
|
|
| 1075 |
ts = time.strftime("%H:%M:%S")
|
| 1076 |
return copy.deepcopy(workflow_data), f"πΎ Auto-save: Saved β ({ts})"
|
| 1077 |
|
| 1078 |
+
# 1) μ¦κ° μ μ₯(νΈμ§ μ΄λ²€νΈ)
|
| 1079 |
wb.change(
|
| 1080 |
fn=periodic_save,
|
| 1081 |
inputs=[wb],
|
| 1082 |
outputs=[loaded_data, save_indicator]
|
| 1083 |
)
|
| 1084 |
|
| 1085 |
+
# 2) 5μ΄ μ£ΌκΈ° λ°±μ
|
| 1086 |
auto_timer = gr.Timer(5)
|
| 1087 |
auto_timer.tick(
|
| 1088 |
fn=periodic_save,
|
| 1089 |
inputs=[wb],
|
| 1090 |
outputs=[loaded_data, save_indicator]
|
| 1091 |
)
|
| 1092 |
+
# -------------------------------
|
| 1093 |
|
| 1094 |
return wb
|
| 1095 |
|
| 1096 |
|
| 1097 |
+
|
| 1098 |
+
|
| 1099 |
|
| 1100 |
# βββ Import Section βββ
|
| 1101 |
with gr.Accordion("π₯ Import Workflow", open=True):
|