Spaces:
Running
Running
Juho Inkinen
commited on
Catch failed subject-indexing requests
Browse files
app.py
CHANGED
|
@@ -161,8 +161,12 @@ with gr.Blocks(title="VLM Caption & Annif Demo") as demo:
|
|
| 161 |
# Compose Annif project identifier
|
| 162 |
project_id = f"{project}-{language}"
|
| 163 |
caption = get_caption(image, prompt)
|
| 164 |
-
|
| 165 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 166 |
|
| 167 |
submit_btn.click(
|
| 168 |
run_app,
|
|
|
|
| 161 |
# Compose Annif project identifier
|
| 162 |
project_id = f"{project}-{language}"
|
| 163 |
caption = get_caption(image, prompt)
|
| 164 |
+
try:
|
| 165 |
+
subjects = get_subjects(caption, project_id)
|
| 166 |
+
return caption, subjects
|
| 167 |
+
except gr.Error:
|
| 168 |
+
gr.Warning("Sorry, there was a problem getting subject suggestions.")
|
| 169 |
+
return caption, {}
|
| 170 |
|
| 171 |
submit_btn.click(
|
| 172 |
run_app,
|