Spaces:
Sleeping
Sleeping
Update streamlit_app.py
Browse files- streamlit_app.py +24 -24
streamlit_app.py
CHANGED
|
@@ -340,31 +340,31 @@ def main() -> None:
|
|
| 340 |
|
| 341 |
# ---------- Main panel ----------
|
| 342 |
# Run Analysis button
|
| 343 |
-
if st.button("Run Analysis"):
|
| 344 |
-
|
| 345 |
-
|
| 346 |
-
|
| 347 |
-
|
| 348 |
-
|
| 349 |
# Configure Gemini model with safety settings
|
| 350 |
-
|
| 351 |
-
|
| 352 |
-
|
| 353 |
-
|
| 354 |
-
|
| 355 |
-
|
| 356 |
-
|
| 357 |
-
|
| 358 |
-
|
| 359 |
-
|
| 360 |
-
|
| 361 |
-
|
| 362 |
-
|
| 363 |
-
|
| 364 |
-
|
| 365 |
-
|
| 366 |
-
|
| 367 |
-
|
| 368 |
|
| 369 |
# Configure Gemini with API key and safety settings
|
| 370 |
genai.configure(api_key=st.session_state["api_key"],
|
|
|
|
| 340 |
|
| 341 |
# ---------- Main panel ----------
|
| 342 |
# Run Analysis button
|
| 343 |
+
if st.button("Run Analysis"):
|
| 344 |
+
if not st.session_state.get("video_path"):
|
| 345 |
+
st.error("No video loaded – load a video first.")
|
| 346 |
+
elif not st.session_state.get("api_key"):
|
| 347 |
+
st.error("Google API key missing – enter it in the sidebar.")
|
| 348 |
+
else:
|
| 349 |
# Configure Gemini model with safety settings
|
| 350 |
+
safety_settings = [
|
| 351 |
+
{
|
| 352 |
+
"category": "HARM_CATEGORY_HARASSMENT",
|
| 353 |
+
"threshold": "BLOCK_NONE"
|
| 354 |
+
},
|
| 355 |
+
{
|
| 356 |
+
"category": "HARM_CATEGORY_HATE_SPEECH",
|
| 357 |
+
"threshold": "BLOCK_NONE"
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT",
|
| 361 |
+
"threshold": "BLOCK_NONE"
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"category": "HARM_CATEGORY_DANGEROUS_CONTENT",
|
| 365 |
+
"threshold": "BLOCK_NONE"
|
| 366 |
+
}
|
| 367 |
+
]
|
| 368 |
|
| 369 |
# Configure Gemini with API key and safety settings
|
| 370 |
genai.configure(api_key=st.session_state["api_key"],
|