Ahmed-El-Sharkawy commited on
Commit
c7c0ff2
·
verified ·
1 Parent(s): 85515bf

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +21 -14
main.py CHANGED
@@ -3,25 +3,32 @@ import google.generativeai as genai
3
  import os
4
 
5
  import os
6
- api_key = os.getenv("api_key")
7
- # Configure API key
8
- GOOGLE_API_KEY = api_key # Or hardcode for testing
9
- genai.configure(api_key=GOOGLE_API_KEY)
10
 
11
- # Initialize model
12
- model = genai.GenerativeModel('gemini-1.5-flash')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
 
14
- Medical_prompt = """you are sahha chatbot ,You are a knowledgeable medical expert. Analyze the provided medical input and generate a comprehensive, informative response that addresses the patient's query or medical scenario and give me brief answer in short .
15
- ### Input:
16
- {input_text}
17
- ### Response:
18
- """
19
 
20
  def generate_response(input_text):
21
- prompt = Medical_prompt.format(input_text=input_text)
22
  try:
23
- response = model.generate_content(prompt)
24
- return response.text.strip()
25
  except Exception as e:
26
  return f"❌ Error: {str(e)}"
27
 
 
3
  import os
4
 
5
  import os
6
+ # api_key = os.getenv("api_key")
7
+ # # Configure API key
8
+ # GOOGLE_API_KEY = api_key # Or hardcode for testing
9
+ # genai.configure(api_key=GOOGLE_API_KEY)
10
 
11
+ # # Initialize model
12
+ # model = genai.GenerativeModel('gemini-1.5-flash')
13
+
14
+ # Medical_prompt = """you are sahha chatbot ,You are a knowledgeable medical expert. Analyze the provided medical input and generate a comprehensive, informative response that addresses the patient's query or medical scenario and give me brief answer in short .
15
+ # ### Input:
16
+ # {input_text}
17
+ # ### Response:
18
+ # """
19
+
20
+ # def generate_response(input_text):
21
+ # prompt = Medical_prompt.format(input_text=input_text)
22
+ # try:
23
+ # response = model.generate_content(prompt)
24
+ # return response.text.strip()
25
+ # except Exception as e:
26
+ # return f"❌ Error: {str(e)}"
27
 
 
 
 
 
 
28
 
29
  def generate_response(input_text):
 
30
  try:
31
+ return "Hello"
 
32
  except Exception as e:
33
  return f"❌ Error: {str(e)}"
34