Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -3,35 +3,35 @@ 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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
# def generate_response(input_text):
|
|
|
|
| 30 |
# try:
|
| 31 |
-
#
|
|
|
|
| 32 |
# except Exception as e:
|
| 33 |
# return f"❌ Error: {str(e)}"
|
| 34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
app = Flask(__name__)
|
| 36 |
|
| 37 |
@app.route('/', methods=['GET'])
|
|
|
|
| 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 |
+
|
| 35 |
app = Flask(__name__)
|
| 36 |
|
| 37 |
@app.route('/', methods=['GET'])
|