Spaces:
Runtime error
Runtime error
joaomorossini
commited on
Commit
·
174f0ca
1
Parent(s):
4be6783
Update app.py
Browse files
app.py
CHANGED
@@ -71,11 +71,12 @@ def captioner(image):
|
|
71 |
base64_image = image_to_base64_str(image)
|
72 |
results = get_completion(base64_image)
|
73 |
captions = []
|
|
|
74 |
for endpoint, result in results.items():
|
75 |
if "error" not in result:
|
76 |
-
caption =
|
77 |
else:
|
78 |
-
caption = f"
|
79 |
captions.append(caption)
|
80 |
return "".join(captions) # Join all captions into a single string
|
81 |
|
|
|
71 |
base64_image = image_to_base64_str(image)
|
72 |
results = get_completion(base64_image)
|
73 |
captions = []
|
74 |
+
separator = "-" * 50
|
75 |
for endpoint, result in results.items():
|
76 |
if "error" not in result:
|
77 |
+
caption = f"[{endpoint}]({hf_base_url+endpoint}): \n\n {result[0]['generated_text']} \n {separator} \n\n "
|
78 |
else:
|
79 |
+
caption = f"[{endpoint}]({hf_base_url+endpoint}): \n\n Error - {result['error']} \n {separator} \n\n "
|
80 |
captions.append(caption)
|
81 |
return "".join(captions) # Join all captions into a single string
|
82 |
|