lalashechka commited on
Commit
513f142
1 Parent(s): 6624c7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -6
app.py CHANGED
@@ -46,25 +46,22 @@ 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("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"))))
62
  return photo
63
 
64
-
65
  if task == "Artigen v3":
66
  artigen = str(os.getenv("artigen"))
67
- with closing(create_connection(artigen)) as conn:
68
  conn.send('{"fn_index":0,"session_hash":""}')
69
  conn.send(f'{{"fn_index":0,"data":["{prompt}", 0, "No style"],"session_hash":""}}')
70
  conn.recv()
 
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-arpr.hf.space/queue/join")) as conn:
50
  conn.send('{"fn_index":0,"session_hash":""}')
51
+ conn.send(f'{{"fn_index":0,"data":["{prompt}"],"session_hash":""}}')
 
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"))))
60
  return photo
61
 
 
62
  if task == "Artigen v3":
63
  artigen = str(os.getenv("artigen"))
64
+ with closing(create_connection("wss://ashrafb-arv3s.hf.space/queue/join")) as conn:
65
  conn.send('{"fn_index":0,"session_hash":""}')
66
  conn.send(f'{{"fn_index":0,"data":["{prompt}", 0, "No style"],"session_hash":""}}')
67
  conn.recv()