Muhammad Abdiel Al Hafiz
commited on
Commit
·
fffe0aa
1
Parent(s):
7405238
set custom prompt for normal prediction
Browse files
app.py
CHANGED
@@ -17,13 +17,23 @@ genai.configure(api_key=api_key)
|
|
17 |
labels = ['cataract', 'diabetic_retinopathy', 'glaucoma', 'normal']
|
18 |
|
19 |
def get_disease_detail(disease_name):
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
try:
|
28 |
response = genai.GenerativeModel("gemini-1.5-flash").generate_content(prompt)
|
29 |
return markdown2.markdown(response.text.strip())
|
@@ -59,7 +69,7 @@ example_images = [
|
|
59 |
# Custom CSS for HTML height
|
60 |
css = """
|
61 |
.scrollable-html {
|
62 |
-
height:
|
63 |
overflow-y: auto; /* Enable vertical scrolling */
|
64 |
border: 1px solid #ccc; /* Optional: border for visibility */
|
65 |
padding: 10px; /* Optional: padding for content */
|
|
|
17 |
labels = ['cataract', 'diabetic_retinopathy', 'glaucoma', 'normal']
|
18 |
|
19 |
def get_disease_detail(disease_name):
|
20 |
+
if disease_name == "normal":
|
21 |
+
prompt = (
|
22 |
+
"Hello! Your eye health looks great. Keep up the good work!\n\n"
|
23 |
+
"Here are some tips to maintain healthy eyes:\n"
|
24 |
+
"- Eat a balanced diet rich in vitamins A, C, and E.\n"
|
25 |
+
"- Get regular eye check-ups.\n"
|
26 |
+
"- Protect your eyes from UV light by wearing sunglasses.\n"
|
27 |
+
"Stay healthy and always take care of your eyes!"
|
28 |
+
)
|
29 |
+
else:
|
30 |
+
prompt = (
|
31 |
+
f"Diagnosis: {disease_name}\n\n"
|
32 |
+
"What is it?\n(Description about {disease_name})\n\n"
|
33 |
+
"What causes it?\n(Explain what causes {disease_name})\n\n"
|
34 |
+
"Suggestion\n(Suggestion to user)\n\n"
|
35 |
+
"Reminder: Always seek professional help, such as a doctor."
|
36 |
+
)
|
37 |
try:
|
38 |
response = genai.GenerativeModel("gemini-1.5-flash").generate_content(prompt)
|
39 |
return markdown2.markdown(response.text.strip())
|
|
|
69 |
# Custom CSS for HTML height
|
70 |
css = """
|
71 |
.scrollable-html {
|
72 |
+
height: 280px; /* Adjust this height as needed */
|
73 |
overflow-y: auto; /* Enable vertical scrolling */
|
74 |
border: 1px solid #ccc; /* Optional: border for visibility */
|
75 |
padding: 10px; /* Optional: padding for content */
|