Yntec commited on
Commit
1d18b97
·
verified ·
1 Parent(s): 95df813

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -61,16 +61,17 @@ 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
- 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
@@ -96,7 +97,7 @@ with gr.Blocks(theme='John6666/YntecDark', fill_width=True, css=css) as myface:
96
  <div class="center"><h1>Blitz Diffusion</h1></div>
97
  <p style="margin-bottom: 1px; color: #ffaa66;">
98
  <h3>{int(len(models))} Stable Diffusion models, but why? For your enjoyment!</h3></p>
99
- <br><div class="wrapper">11.21 <img src="https://huggingface.co/Yntec/DucHaitenLofi/resolve/main/NEW.webp" alt="NEW!" style="width:32px;height:16px;">This has become a legacy backup copy of old <u><a href="https://huggingface.co/spaces/Yntec/ToyWorld">ToyWorld</a></u>'s UI! Newer models added dailty over there! 8 new models since last update!</div>
100
  <p style="margin-bottom: 1px; font-size: 98%">
101
  <br><h4>If a model is already loaded each new image takes less than <b>10</b> seconds to generate!</h4></p>
102
  <p style="margin-bottom: 1px; color: #ffffff;">
 
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_index, prompt, nprompt,
67
+ height, width, steps, cfg, seed, inference_timeout))
68
  except (Exception, asyncio.CancelledError) as e:
69
  print(e)
70
+ print(f"Task aborted: {models[model_index]}")with lock:
 
71
  with lock:
72
+ image = "https://huggingface.co/spaces/Yntec/ToyWorld/resolve/main/error.png"
73
  result = image
74
+ raise gr.Error(f"Task aborted: {models[model_index]}, Error: {e}")
75
  finally:
76
  loop.close()
77
  return result
 
97
  <div class="center"><h1>Blitz Diffusion</h1></div>
98
  <p style="margin-bottom: 1px; color: #ffaa66;">
99
  <h3>{int(len(models))} Stable Diffusion models, but why? For your enjoyment!</h3></p>
100
+ <br><div class="wrapper">12.21 <img src="https://huggingface.co/Yntec/DucHaitenLofi/resolve/main/NEW.webp" alt="NEW!" style="width:32px;height:16px;">This has become a legacy backup copy of old <u><a href="https://huggingface.co/spaces/Yntec/ToyWorld">ToyWorld</a></u>'s UI! Newer models added dailty over there! 19 new models since last update!</div>
101
  <p style="margin-bottom: 1px; font-size: 98%">
102
  <br><h4>If a model is already loaded each new image takes less than <b>10</b> seconds to generate!</h4></p>
103
  <p style="margin-bottom: 1px; color: #ffffff;">