Rooni commited on
Commit
cfe183b
·
1 Parent(s): d8785cf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -1
app.py CHANGED
@@ -73,4 +73,25 @@ def flip_text(prompt, negative_prompt, task, steps, sampler, cfg_scale, seed):
73
 
74
  def mirror(image_output, scale_by, method, gfpgan, codeformer):
75
 
76
- url_up = "https://scale-diffusion-open.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  def mirror(image_output, scale_by, method, gfpgan, codeformer):
75
 
76
+ url_up = "https://scale-diffusion-open.api.replicate.com/infer"
77
+ url_up_f = "https://scale-diffusion-open.api.replicate.com/output/"
78
+
79
+ scale_by = int(scale_by)
80
+ gfpgan = int(gfpgan)
81
+ codeformer = int(codeformer)
82
+
83
+ with open(image_output, "rb") as image_file:
84
+ encoded_string2 = base64.b64encode(image_file.read())
85
+ encoded_string2 = str(encoded_string2).replace("b'", '')
86
+
87
+ encoded_string2 = "data:image/png;base64," + encoded_string2
88
+ data = {
89
+ "fn_index": 81,
90
+ "data": [0, 0, encoded_string2, None, "", "", True, gfpgan, codeformer, 0, scale_by, 512, 512, None, method, "None", 1, False, [], "", ""],
91
+ "session_hash": ""
92
+ }
93
+
94
+ r = requests.post(f"{url_up}", json=data, timeout=100)
95
+ print(r.text)
96
+ ph = f"{url_up_f}" + str(r.json()['data'][0][0]['name'])
97
+ return ph