Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -28,8 +28,7 @@ except ImportError as e:
|
|
| 28 |
Sam3Model = None
|
| 29 |
Sam3Processor = None
|
| 30 |
root_agent = None
|
| 31 |
-
AnalysisDeps = None
|
| 32 |
-
|
| 33 |
|
| 34 |
# Optional: Distinctipy for better colors
|
| 35 |
try:
|
|
@@ -269,6 +268,12 @@ async def run_analysis(image_path_str, user_prompt, session_id_state):
|
|
| 269 |
yield [{"role": "assistant", "content": error_msg}], None, None, [], None, waiting_df, waiting_df, waiting_df, *empty_slider_updates
|
| 270 |
return
|
| 271 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 272 |
deps = AnalysisDeps(
|
| 273 |
sam_model=MODEL_CACHE["model"],
|
| 274 |
sam_processor=MODEL_CACHE["processor"],
|
|
@@ -298,7 +303,7 @@ async def run_analysis(image_path_str, user_prompt, session_id_state):
|
|
| 298 |
|
| 299 |
logs = [f"🔄 **Starting analysis** on {MODEL_CACHE['device']}..."]
|
| 300 |
|
| 301 |
-
# FIX: Encode spaces
|
| 302 |
display_path = image_path_str.replace(" ", "%20")
|
| 303 |
|
| 304 |
def yield_status(log_list):
|
|
|
|
| 28 |
Sam3Model = None
|
| 29 |
Sam3Processor = None
|
| 30 |
root_agent = None
|
| 31 |
+
AnalysisDeps = None # <--- FIX: Indented inside except block
|
|
|
|
| 32 |
|
| 33 |
# Optional: Distinctipy for better colors
|
| 34 |
try:
|
|
|
|
| 268 |
yield [{"role": "assistant", "content": error_msg}], None, None, [], None, waiting_df, waiting_df, waiting_df, *empty_slider_updates
|
| 269 |
return
|
| 270 |
|
| 271 |
+
# FIX: Add safety check for AnalysisDeps
|
| 272 |
+
if AnalysisDeps is None:
|
| 273 |
+
error_msg = "❌ Project imports failed. 'AnalysisDeps' is missing. Check your 'cellemetry' package installation."
|
| 274 |
+
yield [{"role": "assistant", "content": error_msg}], None, None, [], None, waiting_df, waiting_df, waiting_df, *empty_slider_updates
|
| 275 |
+
return
|
| 276 |
+
|
| 277 |
deps = AnalysisDeps(
|
| 278 |
sam_model=MODEL_CACHE["model"],
|
| 279 |
sam_processor=MODEL_CACHE["processor"],
|
|
|
|
| 303 |
|
| 304 |
logs = [f"🔄 **Starting analysis** on {MODEL_CACHE['device']}..."]
|
| 305 |
|
| 306 |
+
# FIX: Encode spaces for Markdown
|
| 307 |
display_path = image_path_str.replace(" ", "%20")
|
| 308 |
|
| 309 |
def yield_status(log_list):
|