Hug0endob commited on
Commit
4604763
·
verified ·
1 Parent(s): 4d0af4e

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +30 -9
streamlit_app.py CHANGED
@@ -339,15 +339,36 @@ def main() -> None:
339
  )
340
 
341
  # ---------- Main panel ----------
342
- # Run Analysis button (placed after settings for visual flow)
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 now that we have a key
350
- genai.configure(api_key=st.session_state["api_key"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
351
 
352
  st.session_state["busy"] = True
353
  st.session_state["analysis_out"] = ""
 
339
  )
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"],
371
+ safety_settings=safety_settings) # Set safety to lowest (none)
372
 
373
  st.session_state["busy"] = True
374
  st.session_state["analysis_out"] = ""