Paul Ke commited on
Commit
8b9e51e
·
verified ·
1 Parent(s): 1197d6b

Update streamlit_app.py

Browse files
Files changed (1) hide show
  1. streamlit_app.py +28 -1
streamlit_app.py CHANGED
@@ -14,6 +14,14 @@ import google.generativeai as genai
14
  from pathlib import Path
15
  import tempfile
16
 
 
 
 
 
 
 
 
 
17
  from dotenv import load_dotenv
18
  load_dotenv()
19
 
@@ -63,9 +71,28 @@ API_KEY = expander.text_input("Google API Key", "AIzaSyB2uDj6IeuNszSuk80feW-eBgp
63
  if API_KEY:
64
  genai.configure(api_key=API_KEY)
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  #Gemini Model
67
  model_id = expander.text_input("Gemini Model", "gemini-2.0-flash-exp")
68
- safety_settings = [ { "category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE" }, { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_NONE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_NONE" }, ]
69
 
70
  # Analysis prompt
71
  analysis_prompt = expander.text_area("Enter analysis")
 
14
  from pathlib import Path
15
  import tempfile
16
 
17
+ from google.genai.types import (
18
+ GenerateContentConfig,
19
+ HarmCategory,
20
+ HarmBlockThreshold,
21
+ HttpOptions,
22
+ SafetySetting,
23
+ )
24
+
25
  from dotenv import load_dotenv
26
  load_dotenv()
27
 
 
71
  if API_KEY:
72
  genai.configure(api_key=API_KEY)
73
 
74
+ #Safety Settings
75
+ safety_settings = [
76
+ SafetySetting(
77
+ category=HarmCategory.HARM_CATEGORY_DANGEROUS_CONTENT,
78
+ threshold=HarmBlockThreshold.OFF,
79
+ ),
80
+ SafetySetting(
81
+ category=HarmCategory.HARM_CATEGORY_HARASSMENT,
82
+ threshold=HarmBlockThreshold.OFF,
83
+ ),
84
+ SafetySetting(
85
+ category=HarmCategory.HARM_CATEGORY_HATE_SPEECH,
86
+ threshold=HarmBlockThreshold.OFF,
87
+ ),
88
+ SafetySetting(
89
+ category=HarmCategory.HARM_CATEGORY_SEXUALLY_EXPLICIT,
90
+ threshold=HarmBlockThreshold.OFF,
91
+ ),
92
+ ]
93
+
94
  #Gemini Model
95
  model_id = expander.text_input("Gemini Model", "gemini-2.0-flash-exp")
 
96
 
97
  # Analysis prompt
98
  analysis_prompt = expander.text_area("Enter analysis")