Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -95,7 +95,8 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
| 95 |
theSeed = seed
|
| 96 |
kwargs["seed"] = theSeed
|
| 97 |
|
| 98 |
-
task = asyncio.create_task(asyncio.to_thread(models_load[model_str].fn, prompt=prompt, negative_prompt=nprompt, **kwargs, token=HF_TOKEN))
|
|
|
|
| 99 |
await asyncio.sleep(0)
|
| 100 |
try:
|
| 101 |
result = await asyncio.wait_for(task, timeout=timeout)
|
|
@@ -121,8 +122,7 @@ async def infer(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0
|
|
| 121 |
def gen_fn(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1):
|
| 122 |
try:
|
| 123 |
loop = asyncio.new_event_loop()
|
| 124 |
-
result = loop.run_until_complete(infer(model_str, prompt, nprompt,
|
| 125 |
-
height, width, steps, cfg, seed, inference_timeout))
|
| 126 |
except (Exception, asyncio.CancelledError) as e:
|
| 127 |
print(e)
|
| 128 |
print(f"gen_fn: Task aborted: {model_str}")
|
|
|
|
| 95 |
theSeed = seed
|
| 96 |
kwargs["seed"] = theSeed
|
| 97 |
|
| 98 |
+
# task = asyncio.create_task(asyncio.to_thread(models_load[model_str].fn, prompt=prompt, negative_prompt=nprompt, **kwargs, token=HF_TOKEN))
|
| 99 |
+
task = asyncio.create_task(asyncio.to_thread(models_load[model_str].fn, prompt=prompt, negative_prompt=nprompt, **kwargs))
|
| 100 |
await asyncio.sleep(0)
|
| 101 |
try:
|
| 102 |
result = await asyncio.wait_for(task, timeout=timeout)
|
|
|
|
| 122 |
def gen_fn(model_str, prompt, nprompt="", height=0, width=0, steps=0, cfg=0, seed=-1):
|
| 123 |
try:
|
| 124 |
loop = asyncio.new_event_loop()
|
| 125 |
+
result = loop.run_until_complete(infer(model_str, prompt, nprompt, height, width, steps, cfg, seed, inference_timeout))
|
|
|
|
| 126 |
except (Exception, asyncio.CancelledError) as e:
|
| 127 |
print(e)
|
| 128 |
print(f"gen_fn: Task aborted: {model_str}")
|