lnyan commited on
Commit
628d57a
1 Parent(s): 0a683e1
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -62,7 +62,7 @@ def load_encoders():
62
  import numpy as np
63
  def b64(txt,vec):
64
  buffer = io.BytesIO()
65
- np.savez_compressed(buffer, txt=txt, vec=vec)
66
  buffer.seek(0)
67
  encoded = base64.b64encode(buffer.getvalue()).decode('utf-8')
68
  return encoded
@@ -74,7 +74,7 @@ def convert(prompt):
74
  prompt = [prompt]
75
  txt = t5(prompt)
76
  vec = clip(prompt)
77
- return b64(txt.cpu().numpy(),vec.cpu().numpy())
78
 
79
  with gr.Blocks() as demo:
80
  gr.Markdown("""A workaround for flux-flax to fit into 40G VRAM""")
 
62
  import numpy as np
63
  def b64(txt,vec):
64
  buffer = io.BytesIO()
65
+ torch.save((txt,vec), buffer)
66
  buffer.seek(0)
67
  encoded = base64.b64encode(buffer.getvalue()).decode('utf-8')
68
  return encoded
 
74
  prompt = [prompt]
75
  txt = t5(prompt)
76
  vec = clip(prompt)
77
+ return b64(txt,vec)
78
 
79
  with gr.Blocks() as demo:
80
  gr.Markdown("""A workaround for flux-flax to fit into 40G VRAM""")