Spaces:
Runtime error
Runtime error
lalashechka
commited on
Commit
•
5cdcae7
1
Parent(s):
27e4d4f
Update app.py
Browse files
app.py
CHANGED
@@ -38,38 +38,22 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
|
|
38 |
height = 1024
|
39 |
|
40 |
if task == "Playground v2":
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
conn.recv()
|
49 |
-
conn.recv()
|
50 |
-
a = conn.recv()
|
51 |
-
print(">> A:", a)
|
52 |
-
photo = json.loads(a)['output']['data'][0]
|
53 |
-
photo = photo.replace('data:image/jpeg;base64,', '').replace('data:image/png;base64,', '')
|
54 |
-
photo = Image.open(io.BytesIO(base64.decodebytes(bytes(photo, "utf-8"))))
|
55 |
-
return photo
|
56 |
|
57 |
if task == "Artigen v3":
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
conn.recv()
|
66 |
-
conn.recv()
|
67 |
-
a = conn.recv()
|
68 |
-
print(">> A:", a)
|
69 |
-
photo = json.loads(a)['output']['data'][0]
|
70 |
-
photo = photo.replace('data:image/jpeg;base64,', '').replace('data:image/png;base64,', '')
|
71 |
-
photo = Image.open(io.BytesIO(base64.decodebytes(bytes(photo, "utf-8"))))
|
72 |
-
return photo
|
73 |
try:
|
74 |
with closing(create_connection("wss://google-sdxl.hf.space/queue/join")) as conn:
|
75 |
conn.send('{"fn_index":3,"session_hash":""}')
|
|
|
38 |
height = 1024
|
39 |
|
40 |
if task == "Playground v2":
|
41 |
+
ua = UserAgent()
|
42 |
+
headers = {
|
43 |
+
'user-agent': f'{ua.random}'
|
44 |
+
}
|
45 |
+
client = Client("https://ashrafb-arpr.hf.space/", headers=headers)
|
46 |
+
result = client.predict(prompt, fn_index=0)
|
47 |
+
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
48 |
|
49 |
if task == "Artigen v3":
|
50 |
+
ua = UserAgent()
|
51 |
+
headers = {
|
52 |
+
'user-agent': f'{ua.random}'
|
53 |
+
}
|
54 |
+
client = Client("https://ashrafb-arv3s.hf.space/", headers=headers)
|
55 |
+
result = client.predict("cat",0,"Cinematic", fn_index=0)
|
56 |
+
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
try:
|
58 |
with closing(create_connection("wss://google-sdxl.hf.space/queue/join")) as conn:
|
59 |
conn.send('{"fn_index":3,"session_hash":""}')
|