File size: 1,059 Bytes
34b6c63 a34321f 4c6474d 0329732 a34321f 0329732 a34321f 34b6c63 0329732 a34321f 0329732 a34321f 0329732 a34321f 34b6c63 0329732 34b6c63 2228c74 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
import gradio as gr
import subprocess
import os
def run_workflow():
try:
print("π Checking if hr.py exists...")
script_path = "ComfyUI/hr.py"
if not os.path.exists(script_path):
print("β Error: hr.py not found!")
return "Error: hr.py not found!"
print("β
Running hr.py...")
result = subprocess.run(["python", script_path], capture_output=True, text=True)
if result.returncode == 0:
print("β
Execution Successful!")
return result.stdout
else:
print(f"β Execution Failed:\n{result.stderr}")
return f"Error:\n{result.stderr}"
except Exception as e:
print(f"β Exception: {str(e)}")
return f"Exception: {str(e)}"
ui = gr.Interface(
fn=run_workflow,
inputs=[],
outputs="text",
title="Run ComfyUI Workflow",
description="Click the button to execute hr.py and generate an image."
)
print("π Launching Gradio UI...")
if __name__ == "__main__":
ui.launch(share=True)
|