Manishh-07 commited on
Commit
2228c74
·
verified ·
1 Parent(s): 7c89010

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -8
app.py CHANGED
@@ -2,24 +2,19 @@ import gradio as gr
2
  import subprocess
3
  import os
4
 
5
- # Define the function to run hr.py
6
  def run_workflow():
7
  try:
8
- # Ensure the script exists
9
  script_path = "ComfyUI/hr.py"
10
  if not os.path.exists(script_path):
11
  return "Error: hr.py not found!"
12
 
13
- # Run the script
14
  result = subprocess.run(["python", script_path], capture_output=True, text=True)
15
-
16
- # Return the output
17
  return result.stdout if result.returncode == 0 else f"Error:\n{result.stderr}"
18
 
19
  except Exception as e:
20
  return f"Exception: {str(e)}"
21
 
22
- # Create a simple UI with a button
23
  ui = gr.Interface(
24
  fn=run_workflow,
25
  inputs=[],
@@ -28,6 +23,6 @@ ui = gr.Interface(
28
  description="Click the button to execute hr.py and generate an image."
29
  )
30
 
31
- # Launch the Gradio app
32
  if __name__ == "__main__":
33
- ui.launch()
 
2
  import subprocess
3
  import os
4
 
 
5
  def run_workflow():
6
  try:
7
+ print("Executing hr.py...") # Debugging log
8
  script_path = "ComfyUI/hr.py"
9
  if not os.path.exists(script_path):
10
  return "Error: hr.py not found!"
11
 
 
12
  result = subprocess.run(["python", script_path], capture_output=True, text=True)
 
 
13
  return result.stdout if result.returncode == 0 else f"Error:\n{result.stderr}"
14
 
15
  except Exception as e:
16
  return f"Exception: {str(e)}"
17
 
 
18
  ui = gr.Interface(
19
  fn=run_workflow,
20
  inputs=[],
 
23
  description="Click the button to execute hr.py and generate an image."
24
  )
25
 
26
+ print("Launching Gradio UI...") # Debugging log
27
  if __name__ == "__main__":
28
+ ui.launch(share=True)