Spaces:
Sleeping
Sleeping
Update backend/models.py
Browse files- backend/models.py +6 -0
backend/models.py
CHANGED
|
@@ -14,8 +14,14 @@ def summarizer(text):
|
|
| 14 |
payload = {"inputs": text}
|
| 15 |
|
| 16 |
response = requests.post(url, headers=headers, json=payload)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
return response.json()
|
| 18 |
|
|
|
|
| 19 |
# دالة توليد وصف الصور
|
| 20 |
def image_captioning(image_bytes):
|
| 21 |
url = "https://api-inference.huggingface.co/models/nlpconnect/vit-gpt2-image-captioning"
|
|
|
|
| 14 |
payload = {"inputs": text}
|
| 15 |
|
| 16 |
response = requests.post(url, headers=headers, json=payload)
|
| 17 |
+
|
| 18 |
+
# ✅ طباعة الاستجابة لمعرفة ما يحدث
|
| 19 |
+
print("API Response Status Code:", response.status_code)
|
| 20 |
+
print("API Response:", response.json())
|
| 21 |
+
|
| 22 |
return response.json()
|
| 23 |
|
| 24 |
+
|
| 25 |
# دالة توليد وصف الصور
|
| 26 |
def image_captioning(image_bytes):
|
| 27 |
url = "https://api-inference.huggingface.co/models/nlpconnect/vit-gpt2-image-captioning"
|