Omnibus commited on
Commit
382d70a
1 Parent(s): 7b52fe5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -15
app.py CHANGED
@@ -17,21 +17,24 @@ print (loaded_model)
17
  def run_dif(out_prompt):
18
  out_box=[]
19
  for i,ea in enumerate(loaded_model):
20
- print (ea)
21
- model=loaded_model[int(i)]
22
- out_img=model(out_prompt)
23
- print(out_img)
24
- url=f'https://omnibus-top-20.hf.space/file={out_img}'
25
- print(url)
26
- uid = uuid.uuid4()
27
- #urllib.request.urlretrieve(image, 'tmp.png')
28
- #out=Image.open('tmp.png')
29
- r = requests.get(url, stream=True)
30
- if r.status_code == 200:
31
- out = Image.open(io.BytesIO(r.content))
32
- out_box.append(out)
33
- yield out_box
34
-
 
 
 
35
  with gr.Blocks() as app:
36
  inp=gr.Textbox()
37
  outp=gr.Gallery()
 
17
  def run_dif(out_prompt):
18
  out_box=[]
19
  for i,ea in enumerate(loaded_model):
20
+ try:
21
+ print (ea)
22
+ model=loaded_model[int(i)]
23
+ out_img=model(out_prompt)
24
+ print(out_img)
25
+ url=f'https://omnibus-top-20.hf.space/file={out_img}'
26
+ print(url)
27
+ uid = uuid.uuid4()
28
+ #urllib.request.urlretrieve(image, 'tmp.png')
29
+ #out=Image.open('tmp.png')
30
+ r = requests.get(url, stream=True)
31
+ if r.status_code == 200:
32
+ print (f'bytes:: {io.BytesIO(r.content)}')
33
+ out = Image.open(io.BytesIO(r.content))
34
+ out_box.append(out)
35
+ yield out_box
36
+ except Exception:
37
+ yield out_box
38
  with gr.Blocks() as app:
39
  inp=gr.Textbox()
40
  outp=gr.Gallery()