Dede16 commited on
Commit
c5e7fe4
·
1 Parent(s): ded3faf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
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
- try:
477
- with open(file_path, 'r') as file:
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", image)}
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