Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -473,16 +473,15 @@ def post(judul, kontent, endpoint,endpoint_media,username,password,tags,categori
|
|
473 |
|
474 |
file_path = 'image_data.txt'
|
475 |
|
476 |
-
|
477 |
-
|
478 |
-
image = file.read()
|
479 |
|
480 |
data = {
|
481 |
"alt_text": judul,
|
482 |
"media_type": "image",
|
483 |
"mime_type": "png"
|
484 |
}
|
485 |
-
files = {"file": ("image.jpg",
|
486 |
try :
|
487 |
response_media= requests.post(endpoint_media, headers=headers, data=data, files=files) # Send
|
488 |
|
|
|
473 |
|
474 |
file_path = 'image_data.txt'
|
475 |
|
476 |
+
with open(file_path, 'r') as file:
|
477 |
+
file_content = file.read()
|
|
|
478 |
|
479 |
data = {
|
480 |
"alt_text": judul,
|
481 |
"media_type": "image",
|
482 |
"mime_type": "png"
|
483 |
}
|
484 |
+
files = {"file": ("image.jpg", file_content)}
|
485 |
try :
|
486 |
response_media= requests.post(endpoint_media, headers=headers, data=data, files=files) # Send
|
487 |
|