pratikshahp commited on
Commit
da5f168
·
verified ·
1 Parent(s): 16cb436

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -23,10 +23,10 @@ def generate_compliment(image):
23
  image.save(buffered, format="JPEG")
24
  image_bytes = buffered.getvalue()
25
 
26
- # Connect to the captioning model on Hugging Face Spaces
27
  captioning_url = "https://gokaygokay-sd3-long-captioner.hf.space/run/create_captions_rich"
28
  try:
29
- caption_response = requests.get(captioning_url, files={"image": ("image.jpg", image_bytes, "image/jpeg")})
30
  caption_response.raise_for_status() # Raise an exception for HTTP errors
31
  except requests.exceptions.RequestException as e:
32
  return "Error", f"Failed to get caption. Exception: {e}"
 
23
  image.save(buffered, format="JPEG")
24
  image_bytes = buffered.getvalue()
25
 
26
+ # Connect to the captioning model on Hugging Face Spaces using the correct URL and method
27
  captioning_url = "https://gokaygokay-sd3-long-captioner.hf.space/run/create_captions_rich"
28
  try:
29
+ caption_response = requests.post(captioning_url, files={"image": ("image.jpg", image_bytes, "image/jpeg")})
30
  caption_response.raise_for_status() # Raise an exception for HTTP errors
31
  except requests.exceptions.RequestException as e:
32
  return "Error", f"Failed to get caption. Exception: {e}"