Spaces:
Running
Running
replace Qwen2-VL with Florence-2 API for caption generation
Browse files
app.py
CHANGED
|
@@ -87,7 +87,7 @@ def generate_captions_api(image):
|
|
| 87 |
"max_tokens": 80
|
| 88 |
}
|
| 89 |
response = requests.post(
|
| 90 |
-
|
| 91 |
headers=HF_HEADERS,
|
| 92 |
json=payload,
|
| 93 |
timeout=40
|
|
@@ -100,7 +100,7 @@ def generate_captions_api(image):
|
|
| 100 |
st.warning("Qwen2-VL API error: " + str(response.status_code) + " " + response.text[:100])
|
| 101 |
captions.append("a scene with various objects and people")
|
| 102 |
except Exception as e:
|
| 103 |
-
st.warning("
|
| 104 |
captions.append("a scene captured in the image")
|
| 105 |
|
| 106 |
seen, unique = set(), []
|
|
|
|
| 87 |
"max_tokens": 80
|
| 88 |
}
|
| 89 |
response = requests.post(
|
| 90 |
+
|
| 91 |
headers=HF_HEADERS,
|
| 92 |
json=payload,
|
| 93 |
timeout=40
|
|
|
|
| 100 |
st.warning("Qwen2-VL API error: " + str(response.status_code) + " " + response.text[:100])
|
| 101 |
captions.append("a scene with various objects and people")
|
| 102 |
except Exception as e:
|
| 103 |
+
st.warning("Florence-2 exception: " + str(e))
|
| 104 |
captions.append("a scene captured in the image")
|
| 105 |
|
| 106 |
seen, unique = set(), []
|