lalashechka commited on
Commit
9306543
1 Parent(s): d45d93b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -0
app.py CHANGED
@@ -55,8 +55,11 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
55
  conn.recv()
56
  a = conn.recv()
57
  photo = json.loads(a)['output']['data'][0]
 
 
58
  return photo
59
 
 
60
  if task == "Artigen v3":
61
  artigen = str(os.getenv("artigen"))
62
  with closing(create_connection(artigen)) as conn:
@@ -68,6 +71,8 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
68
  conn.recv()
69
  a = conn.recv()
70
  photo = json.loads(a)['output']['data'][0]
 
 
71
  return photo
72
 
73
  try:
 
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
+
63
  if task == "Artigen v3":
64
  artigen = str(os.getenv("artigen"))
65
  with closing(create_connection(artigen)) as conn:
 
71
  conn.recv()
72
  a = conn.recv()
73
  photo = json.loads(a)['output']['data'][0]
74
+ photo = photo.replace('data:image/jpeg;base64,', '').replace('data:image/png;base64,', '')
75
+ photo = Image.open(io.BytesIO(base64.decodebytes(bytes(photo, "utf-8"))))
76
  return photo
77
 
78
  try: