Manishh-07's picture
Update app.py
2228c74 verified
raw
history blame
795 Bytes
import gradio as gr
import subprocess
import os
def run_workflow():
try:
print("Executing hr.py...") # Debugging log
script_path = "ComfyUI/hr.py"
if not os.path.exists(script_path):
return "Error: hr.py not found!"
result = subprocess.run(["python", script_path], capture_output=True, text=True)
return result.stdout if result.returncode == 0 else f"Error:\n{result.stderr}"
except Exception as 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...") # Debugging log
if __name__ == "__main__":
ui.launch(share=True)