Update app.py
Browse files
app.py
CHANGED
|
@@ -109,7 +109,10 @@ def analyze_image(image: Image.Image, task: str = "<MORE_DETAILED_CAPTION>") ->
|
|
| 109 |
image_size=RESIZE_DIM
|
| 110 |
)
|
| 111 |
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
| 113 |
|
| 114 |
except Exception as e:
|
| 115 |
raise ValueError(f"Failed to analyze image: {e}")
|
|
|
|
| 109 |
image_size=RESIZE_DIM
|
| 110 |
)
|
| 111 |
|
| 112 |
+
if result is None:
|
| 113 |
+
raise ValueError("Post-processing returned None. The model may not have generated a valid output for the given task.")
|
| 114 |
+
|
| 115 |
+
return result.get(task, "No caption generated.")
|
| 116 |
|
| 117 |
except Exception as e:
|
| 118 |
raise ValueError(f"Failed to analyze image: {e}")
|