lalashechka commited on
Commit
37f1044
1 Parent(s): e626c73

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -8
app.py CHANGED
@@ -39,14 +39,18 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
39
 
40
  url_sd5 = os.getenv("url_sd5")
41
  url_sd6 = os.getenv("url_sd6")
42
-
43
- data = {"inputs":f"{prompt}, 4k photo","options":{"negative_prompt":"[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry","width":1024,"height":1024,"guidance_scale":7,"num_inference_steps":35}}
44
- response = requests.post(f'{url_sd5}', json=data)
45
- print(response.text)
46
- print(response.json()['image']['file_name'])
47
- file_name = response.json()['image']['file_name']
48
- photo = f"{url_sd6}{file_name}.png"
49
- return photo
 
 
 
 
50
 
51
  #with closing(create_connection(f"{url_sd3}", timeout=60)) as conn:
52
  # conn.send('{"fn_index":3,"session_hash":""}')
 
39
 
40
  url_sd5 = os.getenv("url_sd5")
41
  url_sd6 = os.getenv("url_sd6")
42
+ try:
43
+ data = {"inputs":f"{prompt}, 4k photo","options":{"negative_prompt":"[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry","width":1024,"height":1024,"guidance_scale":7,"num_inference_steps":35}}
44
+ response = requests.post(f'{url_sd5}', json=data)
45
+ print(response.text)
46
+ print(response.json()['image']['file_name'])
47
+ file_name = response.json()['image']['file_name']
48
+ photo = f"{url_sd6}{file_name}.png"
49
+ return photo
50
+ except:
51
+ client = Client("https://prodia-sdxl-stable-diffusion-xl.hf.space")
52
+ 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)
53
+ return result
54
 
55
  #with closing(create_connection(f"{url_sd3}", timeout=60)) as conn:
56
  # conn.send('{"fn_index":3,"session_hash":""}')