Spaces:
Running
Running
lalashechka
commited on
Commit
•
6624c7a
1
Parent(s):
9306543
Update app.py
Browse files
app.py
CHANGED
@@ -46,14 +46,16 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
|
|
46 |
hf_token = os.getenv("hf_token")
|
47 |
if task == "Playground v2":
|
48 |
playground = str(os.getenv("playground"))
|
49 |
-
with closing(create_connection(
|
50 |
conn.send('{"fn_index":0,"session_hash":""}')
|
51 |
-
|
|
|
52 |
conn.recv()
|
53 |
conn.recv()
|
54 |
conn.recv()
|
55 |
conn.recv()
|
56 |
a = conn.recv()
|
|
|
57 |
photo = json.loads(a)['output']['data'][0]
|
58 |
photo = photo.replace('data:image/jpeg;base64,', '').replace('data:image/png;base64,', '')
|
59 |
photo = Image.open(io.BytesIO(base64.decodebytes(bytes(photo, "utf-8"))))
|
|
|
46 |
hf_token = os.getenv("hf_token")
|
47 |
if task == "Playground v2":
|
48 |
playground = str(os.getenv("playground"))
|
49 |
+
with closing(create_connection("wss://ashrafb-arv3s.hf.space/queue/join")) as conn:
|
50 |
conn.send('{"fn_index":0,"session_hash":""}')
|
51 |
+
prompt = 'Summer, lake, rain'
|
52 |
+
conn.send(f'{{"fn_index":0,"data":["{prompt}", 0, "No style"],"session_hash":""}}')
|
53 |
conn.recv()
|
54 |
conn.recv()
|
55 |
conn.recv()
|
56 |
conn.recv()
|
57 |
a = conn.recv()
|
58 |
+
print(">> A: ", a)
|
59 |
photo = json.loads(a)['output']['data'][0]
|
60 |
photo = photo.replace('data:image/jpeg;base64,', '').replace('data:image/png;base64,', '')
|
61 |
photo = Image.open(io.BytesIO(base64.decodebytes(bytes(photo, "utf-8"))))
|