openfree commited on
Commit
4fe4bab
Β·
verified Β·
1 Parent(s): 7e74a81

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -11
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
- """λ™μ μœΌλ‘œ WorkflowBuilder λ Œλ”λ§ + 5초 μžλ™ μ €μž₯"""
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": {"value": "VIDraft"},
1047
- "model": {"value": "Gemma-3-r1984-27B"},
1048
- "temperature": {"value": 0.7},
1049
- "system_prompt": {"value": "You are a helpful assistant."}
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
- # 1) 즉각 μ €μž₯ (νŽΈμ§‘ 이벀트)
1076
  wb.change(
1077
  fn=periodic_save,
1078
  inputs=[wb],
1079
  outputs=[loaded_data, save_indicator]
1080
  )
1081
 
1082
- # 2) 5초 μ£ΌκΈ° λ°±μ—…
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):