Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -9,7 +9,7 @@ from google.generativeai.types import HarmBlockThreshold, HarmCategory
|
|
9 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
10 |
genai.configure(api_key=GOOGLE_API_KEY)
|
11 |
MODEL_ID = "gemini-1.5-pro-002"
|
12 |
-
model = GenerativeModel(MODEL_ID)
|
13 |
|
14 |
example_model = GenerativeModel(
|
15 |
MODEL_ID,
|
@@ -56,23 +56,6 @@ def analyze_text(text):
|
|
56 |
response
|
57 |
return response.text if response else "No response generated."
|
58 |
|
59 |
-
# Function to analyze images
|
60 |
-
def analyze_image(image):
|
61 |
-
image = image.convert("RGB") # Convert image to RGB
|
62 |
-
prompt = "Analyze this image for any instances of gender-based discrimination and provide tips."
|
63 |
-
generation_config = genai.types.GenerationConfig(
|
64 |
-
temperature=0.5,
|
65 |
-
max_output_tokens=300,
|
66 |
-
stop_sequences=["\n"],
|
67 |
-
top_k=40,
|
68 |
-
top_p=0.9,
|
69 |
-
system_instructions=system_instructions,
|
70 |
-
safety_settings=safety_settings
|
71 |
-
)
|
72 |
-
response = model.generate_content([prompt, image], generation_config=generation_config)
|
73 |
-
return response.text if response else "No response generated."
|
74 |
-
|
75 |
-
|
76 |
# Gradio interface setup
|
77 |
with gr.Blocks() as app:
|
78 |
with gr.Tab("Text Analysis"):
|
|
|
9 |
GOOGLE_API_KEY = os.environ.get("GOOGLE_API_KEY")
|
10 |
genai.configure(api_key=GOOGLE_API_KEY)
|
11 |
MODEL_ID = "gemini-1.5-pro-002"
|
12 |
+
model = genai.GenerativeModel(MODEL_ID)
|
13 |
|
14 |
example_model = GenerativeModel(
|
15 |
MODEL_ID,
|
|
|
56 |
response
|
57 |
return response.text if response else "No response generated."
|
58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
# Gradio interface setup
|
60 |
with gr.Blocks() as app:
|
61 |
with gr.Tab("Text Analysis"):
|