lalashechka commited on
Commit
c7fa2d8
1 Parent(s): 668af3e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -17
app.py CHANGED
@@ -40,25 +40,25 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
40
  print(task)
41
 
42
  try:
43
- client = Client("https://prodia-sdxl-stable-diffusion-xl.hf.space")
44
- result = client.predict(prompt,"[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry","sd_xl_base_1.0.safetensors [be9edd61]",25,"DPM++ 2M Karras",7,1024,1024,-1,fn_index=0)
45
- return result
 
 
 
 
 
 
 
 
 
 
 
46
  except:
47
  try:
48
- print('n_1')
49
- with closing(create_connection(f"{url_sd3}", timeout=60)) as conn:
50
- conn.send('{"fn_index":3,"session_hash":""}')
51
- conn.send(f'{{"data":["{prompt}, 4k photo","[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry",7.5,"(No style)"],"event_data":null,"fn_index":3,"session_hash":""}}')
52
- while True:
53
- status = json.loads(conn.recv())['msg']
54
- if status == 'estimation':
55
- continue
56
- if status == 'process_starts':
57
- break
58
- photo = json.loads(conn.recv())['output']['data'][0][0]
59
- photo = photo.replace('data:image/jpeg;base64,', '').replace('data:image/png;base64,', '')
60
- photo = Image.open(io.BytesIO(base64.decodebytes(bytes(photo, "utf-8"))))
61
- return photo
62
  except:
63
  print("n_2")
64
  print(url_sd4)
 
40
  print(task)
41
 
42
  try:
43
+ print('n_1')
44
+ with closing(create_connection(f"{url_sd3}", timeout=60)) as conn:
45
+ conn.send('{"fn_index":3,"session_hash":""}')
46
+ conn.send(f'{{"data":["{prompt}, 4k photo","[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry",7.5,"(No style)"],"event_data":null,"fn_index":3,"session_hash":""}}')
47
+ while True:
48
+ status = json.loads(conn.recv())['msg']
49
+ if status == 'estimation':
50
+ continue
51
+ if status == 'process_starts':
52
+ break
53
+ photo = json.loads(conn.recv())['output']['data'][0][0]
54
+ photo = photo.replace('data:image/jpeg;base64,', '').replace('data:image/png;base64,', '')
55
+ photo = Image.open(io.BytesIO(base64.decodebytes(bytes(photo, "utf-8"))))
56
+ return photo
57
  except:
58
  try:
59
+ client = Client("https://prodia-sdxl-stable-diffusion-xl.hf.space")
60
+ result = client.predict(prompt,"[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry","sd_xl_base_1.0.safetensors [be9edd61]",25,"DPM++ 2M Karras",7,1024,1024,-1,fn_index=0)
61
+ return result
 
 
 
 
 
 
 
 
 
 
 
62
  except:
63
  print("n_2")
64
  print(url_sd4)