ombhojane commited on
Commit
be096f8
1 Parent(s): 067d559

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -9
app.py CHANGED
@@ -10,12 +10,6 @@ genai.configure(api_key=GEMINI_API)
10
  # Function to configure and use the google.generativeai model
11
  def analyze_plant_disease(image_bytes):
12
 
13
- generation_config = {
14
- "temperature": 0.4,
15
- "top_p": 1,
16
- "top_k": 32,
17
- "max_output_tokens": 4096,
18
- }
19
 
20
  safety_settings = [
21
  {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
@@ -24,9 +18,19 @@ def analyze_plant_disease(image_bytes):
24
  {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
25
  ]
26
 
27
- model = genai.GenerativeModel(model_name="gemini-1.0-pro-vision-latest",
28
- generation_config=generation_config,
29
- safety_settings=safety_settings)
 
 
 
 
 
 
 
 
 
 
30
 
31
  image_parts = [{"mime_type": "image/jpeg", "data": image_bytes}]
32
 
 
10
  # Function to configure and use the google.generativeai model
11
  def analyze_plant_disease(image_bytes):
12
 
 
 
 
 
 
 
13
 
14
  safety_settings = [
15
  {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
 
18
  {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
19
  ]
20
 
21
+ generation_config = {
22
+ "temperature": 1,
23
+ "top_p": 0.95,
24
+ "top_k": 64,
25
+ "max_output_tokens": 8192,
26
+ "response_mime_type": "text/plain",
27
+ }
28
+
29
+ # Part 5: Create the Model
30
+ model = genai.GenerativeModel(
31
+ model_name="gemini-1.5-pro",
32
+ generation_config=generation_config,
33
+ )
34
 
35
  image_parts = [{"mime_type": "image/jpeg", "data": image_bytes}]
36