Uthar commited on
Commit
d59fecb
·
verified ·
1 Parent(s): 8848fec

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -5
app.py CHANGED
@@ -95,16 +95,13 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
95
  def gen_fn(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1):
96
  try:
97
  loop = asyncio.new_event_loop()
98
- result = loop.run_until_complete(infer(model_str, prompt, nprompt,
99
- height, width, steps, cfg, seed, inference_timeout))
100
  except (Exception, asyncio.CancelledError) as e:
101
- print(e)
102
  print(f"gen_fn: Task aborted: {model_str}")
103
- result = None
104
  raise gr.Error(f"Task aborted: {model_str}, Error: {e}")
105
  finally:
106
  loop.close()
107
- return result
108
 
109
 
110
  def add_gallery(image, model_str, gallery):
 
95
  def gen_fn(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1):
96
  try:
97
  loop = asyncio.new_event_loop()
98
+ result, download_path = loop.run_until_complete(infer(model_str, prompt, nprompt, height, width, steps, cfg, seed, inference_timeout))
 
99
  except (Exception, asyncio.CancelledError) as e:
 
100
  print(f"gen_fn: Task aborted: {model_str}")
 
101
  raise gr.Error(f"Task aborted: {model_str}, Error: {e}")
102
  finally:
103
  loop.close()
104
+ return result, download_path
105
 
106
 
107
  def add_gallery(image, model_str, gallery):