Spaces:
Running
Running
lalashechka
commited on
Commit
•
cc8776c
1
Parent(s):
37f1044
Update app.py
Browse files
app.py
CHANGED
@@ -48,9 +48,17 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
|
|
48 |
photo = f"{url_sd6}{file_name}.png"
|
49 |
return photo
|
50 |
except:
|
51 |
-
|
52 |
-
|
53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
|
55 |
#with closing(create_connection(f"{url_sd3}", timeout=60)) as conn:
|
56 |
# conn.send('{"fn_index":3,"session_hash":""}')
|
|
|
48 |
photo = f"{url_sd6}{file_name}.png"
|
49 |
return photo
|
50 |
except:
|
51 |
+
with closing(create_connection(f"{url_sd4}", timeout=60)) as conn:
|
52 |
+
conn.send('{"fn_index":0,"session_hash":""}')
|
53 |
+
conn.send(f'{{"data":["{prompt}","[deformed | disfigured], poorly drawn, [bad : wrong] anatomy, [extra | missing | floating | disconnected] limb, (mutated hands and fingers), blurry","dreamshaperXL10_alpha2.safetensors [c8afe2ef]",30,"DPM++ 2M Karras",7,1024,1024,-1],"event_data":null,"fn_index":0,"session_hash":""}}')
|
54 |
+
conn.recv()
|
55 |
+
conn.recv()
|
56 |
+
conn.recv()
|
57 |
+
conn.recv()
|
58 |
+
photo = json.loads(conn.recv())['output']['data'][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 |
|
63 |
#with closing(create_connection(f"{url_sd3}", timeout=60)) as conn:
|
64 |
# conn.send('{"fn_index":3,"session_hash":""}')
|