sushmit00 commited on
Commit
f18a136
·
verified ·
1 Parent(s): 34f6d55

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -8
app.py CHANGED
@@ -149,26 +149,26 @@ def inference(img_input):
149
  title = "bizarre-pose-estimator"
150
  description = "Gradio demo for Transfer Learning for Pose Estimation of Illustrated Characters. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
151
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.01819' target='_blank'>Transfer Learning for Pose Estimation of Illustrated Characters</a> | <a href='https://github.com/ShuhongChen/bizarre-pose-estimator' target='_blank'>Github Repo</a></p>"
 
152
  examples_list = [[example_img_file]] if os.path.exists(example_img_file) else []
153
 
154
  print("Setting up Gradio Interface...")
155
- # Check if models are ready before launching
156
  if models_ready:
157
- # REMOVE enable_queue=True
158
- # Also update inputs/outputs to newer syntax if possible, but focus on fixing the error first
159
- # Using older gr.inputs/gr.outputs syntax for now as it might be what gradio 2.4.6 expects if it somehow overrides
160
  ui = gr.Interface(
161
  fn=inference,
162
- inputs=gr.inputs.Image(type="filepath", label="Input"), # Using filepath to simplify function logic
163
- outputs=gr.outputs.Image(type="file", label="Output"), # Function returns filepath
 
 
 
164
  title=title,
165
  description=description,
166
  article=article,
167
  allow_flagging="never",
168
  examples=examples_list
169
- # enable_queue=True # REMOVED
170
  )
171
  print("Launching Gradio...")
172
- ui.launch() # queue() method is used in newer Gradio if needed, launch() handles basics
173
  else:
174
  print("Gradio launch aborted because model files are not ready.")
 
149
  title = "bizarre-pose-estimator"
150
  description = "Gradio demo for Transfer Learning for Pose Estimation of Illustrated Characters. To use it, simply upload your image, or click one of the examples to load them. Read more at the links below."
151
  article = "<p style='text-align: center'><a href='https://arxiv.org/abs/2108.01819' target='_blank'>Transfer Learning for Pose Estimation of Illustrated Characters</a> | <a href='https://github.com/ShuhongChen/bizarre-pose-estimator' target='_blank'>Github Repo</a></p>"
152
+ example_img_file = "IkJzlaE.jpeg"
153
  examples_list = [[example_img_file]] if os.path.exists(example_img_file) else []
154
 
155
  print("Setting up Gradio Interface...")
 
156
  if models_ready:
157
+ # --- USE NEWER GRADIO SYNTAX for inputs/outputs ---
 
 
158
  ui = gr.Interface(
159
  fn=inference,
160
+ # Define inputs using component classes directly
161
+ inputs=gr.Image(type="filepath", label="Input"), # Keep type="filepath"
162
+ # Define outputs using component classes directly
163
+ outputs=gr.Image(type="filepath", label="Output"), # Keep type="filepath"
164
+ # --- End of syntax change ---
165
  title=title,
166
  description=description,
167
  article=article,
168
  allow_flagging="never",
169
  examples=examples_list
 
170
  )
171
  print("Launching Gradio...")
172
+ ui.launch()
173
  else:
174
  print("Gradio launch aborted because model files are not ready.")