Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ def run_face_swap(source, target):
|
|
25 |
|
26 |
def upload_image(file):
|
27 |
files = {'file': open(file, 'rb')}
|
28 |
-
img_id = requests.post(os.getenv("
|
29 |
|
30 |
payload = {
|
31 |
"content": "",
|
@@ -33,9 +33,9 @@ def upload_image(file):
|
|
33 |
"replies": [],
|
34 |
"attachments": [img_id]
|
35 |
}
|
36 |
-
res = requests.post(os.getenv("
|
37 |
|
38 |
-
return f"{os.getenv('
|
39 |
|
40 |
|
41 |
def image_to_base64(image: Image):
|
|
|
25 |
|
26 |
def upload_image(file):
|
27 |
files = {'file': open(file, 'rb')}
|
28 |
+
img_id = requests.post(os.getenv("IMAGE_API_1"), files=files).json()['id']
|
29 |
|
30 |
payload = {
|
31 |
"content": "",
|
|
|
33 |
"replies": [],
|
34 |
"attachments": [img_id]
|
35 |
}
|
36 |
+
res = requests.post(os.getenv("IMAGE_API_2"), json=payload, headers={"x-session-token": os.getenv("SESSION_TOKEN")})
|
37 |
|
38 |
+
return f"{os.getenv('IMAGE_API_1')}/{img_id}/{res.json()['attachments'][0]['filename']}"
|
39 |
|
40 |
|
41 |
def image_to_base64(image: Image):
|