Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -61,15 +61,16 @@ async def infer(model_index, prompt, nprompt="", height=0, width=0, steps=0, cfg
|
|
61 |
return None
|
62 |
|
63 |
def gen_fn(model_index, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1):
|
64 |
-
|
65 |
loop = asyncio.new_event_loop()
|
66 |
-
result = loop.run_until_complete(infer(
|
67 |
-
height, width, steps, cfg, seed, inference_timeout))
|
68 |
except (Exception, asyncio.CancelledError) as e:
|
69 |
print(e)
|
70 |
-
print(f"Task aborted: {
|
71 |
result = None
|
72 |
-
|
|
|
|
|
73 |
finally:
|
74 |
loop.close()
|
75 |
return result
|
|
|
61 |
return None
|
62 |
|
63 |
def gen_fn(model_index, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1):
|
64 |
+
try:
|
65 |
loop = asyncio.new_event_loop()
|
66 |
+
result = loop.run_until_complete(infer(model_str, prompt, seed, inference_timeout))
|
|
|
67 |
except (Exception, asyncio.CancelledError) as e:
|
68 |
print(e)
|
69 |
+
print(f"Task aborted: {model_str}")
|
70 |
result = None
|
71 |
+
with lock:
|
72 |
+
image = "https://huggingface.co/spaces/Yntec/HuggingfaceDiffusion/resolve/main/protest.png"
|
73 |
+
result = image
|
74 |
finally:
|
75 |
loop.close()
|
76 |
return result
|