Update app.py
Browse files
app.py
CHANGED
@@ -40,13 +40,13 @@ def query_gpt(api_key, llava_med_result, user_question, model="gpt-4o"):
|
|
40 |
openai.api_key = api_key # Set API key dynamically
|
41 |
prompt = f"""
|
42 |
You are an AI Medical Assistant specializing in radiology, trained to analyze radiology scan findings (e.g., MRI, CT, X-ray) and provide clear, medically accurate explanations.
|
43 |
-
Based on the scan analysis {llava_med_result} and the question {user_question}, provide a concise summary of the radiology findings
|
44 |
-
the question, and offer relevant recommendations such as follow-up imaging, specialist consultations, or further tests. Use clear, professional language, and if uncertain,
|
45 |
recommend consulting a licensed radiologist or healthcare provider.
|
46 |
"""
|
47 |
response = openai.chat.completions.create(
|
48 |
model=model,
|
49 |
-
messages=[{"role": "user", "content": prompt}]
|
|
|
50 |
)
|
51 |
return response.choices[0].message.content
|
52 |
|
|
|
40 |
openai.api_key = api_key # Set API key dynamically
|
41 |
prompt = f"""
|
42 |
You are an AI Medical Assistant specializing in radiology, trained to analyze radiology scan findings (e.g., MRI, CT, X-ray) and provide clear, medically accurate explanations.
|
43 |
+
Based on the scan analysis {llava_med_result} and the question {user_question}, provide a concise summary of the radiology findings. Use clear, professional language, and if uncertain,
|
|
|
44 |
recommend consulting a licensed radiologist or healthcare provider.
|
45 |
"""
|
46 |
response = openai.chat.completions.create(
|
47 |
model=model,
|
48 |
+
messages=[{"role": "user", "content": prompt}],
|
49 |
+
max_tokens=512
|
50 |
)
|
51 |
return response.choices[0].message.content
|
52 |
|