Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -114,3 +114,30 @@ def process_image_workflow(image_path, positive_prompt, seed=-1):
|
|
| 114 |
yield f"查詢連線錯誤: {e}", None
|
| 115 |
return f"查詢連線錯誤: {e}", None
|
| 116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 114 |
yield f"查詢連線錯誤: {e}", None
|
| 115 |
return f"查詢連線錯誤: {e}", None
|
| 116 |
|
| 117 |
+
yield "任務查詢超時,請使用 TaskID 手動查詢。", None
|
| 118 |
+
return "任務查詢超時,請使用 TaskID 手動查詢。", None
|
| 119 |
+
|
| 120 |
+
# --- Gradio 介面 ---
|
| 121 |
+
with gr.Blocks() as demo:
|
| 122 |
+
gr.Markdown("# RunningHub 工作流圖生圖")
|
| 123 |
+
gr.Markdown("上傳圖片,輸入正向提示詞與種子值,啟動遠端工作流任務。")
|
| 124 |
+
|
| 125 |
+
with gr.Row():
|
| 126 |
+
with gr.Column():
|
| 127 |
+
image_input = gr.Image(type="filepath", label="上傳圖片")
|
| 128 |
+
prompt_input = gr.Textbox(lines=3, label="正向提示詞 (Positive Prompt)", placeholder="輸入你想生成的內容...")
|
| 129 |
+
seed_input = gr.Number(label="種子值 (Seed)", value=-1, precision=0)
|
| 130 |
+
process_button = gr.Button("開始處理圖像")
|
| 131 |
+
with gr.Column():
|
| 132 |
+
status_output = gr.Textbox(label="任務狀態", interactive=False)
|
| 133 |
+
image_output = gr.Image(label="生成圖片")
|
| 134 |
+
|
| 135 |
+
process_button.click(
|
| 136 |
+
fn=process_image_workflow,
|
| 137 |
+
inputs=[image_input, prompt_input, seed_input],
|
| 138 |
+
outputs=[status_output, image_output]
|
| 139 |
+
)
|
| 140 |
+
|
| 141 |
+
if __name__ == "__main__":
|
| 142 |
+
demo.launch()
|
| 143 |
+
|