Muhammad Abdiel Al Hafiz
commited on
Commit
·
ba699eb
1
Parent(s):
c2c716f
testing css again
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ import numpy as np
|
|
4 |
from PIL import Image
|
5 |
import google.generativeai as genai
|
6 |
import os
|
|
|
7 |
|
8 |
# Load the TensorFlow model
|
9 |
model_path = 'model'
|
@@ -25,7 +26,7 @@ def get_disease_detail(disease_name):
|
|
25 |
)
|
26 |
try:
|
27 |
response = genai.GenerativeModel("gemini-1.5-flash").generate_content(prompt)
|
28 |
-
return response.text.strip()
|
29 |
except Exception as e:
|
30 |
return f"Error: {e}"
|
31 |
|
@@ -55,14 +56,14 @@ example_images = [
|
|
55 |
["exp_eye_images/image_1002_g.jpg"]
|
56 |
]
|
57 |
|
58 |
-
# Custom CSS for
|
59 |
css = """
|
60 |
-
.scrollable-
|
61 |
-
height:
|
62 |
-
overflow-y:
|
63 |
-
border: 1px solid #ccc;
|
64 |
-
padding: 10px;
|
65 |
-
box-sizing: border-box;
|
66 |
}
|
67 |
"""
|
68 |
|
@@ -72,7 +73,7 @@ interface = gr.Interface(
|
|
72 |
inputs=gr.Image(type="pil"),
|
73 |
outputs=[
|
74 |
gr.Label(num_top_classes=1, label="Prediction"),
|
75 |
-
gr.
|
76 |
],
|
77 |
examples=example_images,
|
78 |
title="Eye Diseases Classifier",
|
@@ -80,7 +81,8 @@ interface = gr.Interface(
|
|
80 |
"Upload an image of an eye fundus, and the model will predict it.\n\n"
|
81 |
"**Disclaimer:** This model is intended as a form of learning process in the field of health-related machine learning and was trained with a limited amount and variety of data with a total of about 4000 data, so the prediction results may not always be correct. There is still a lot of room for improvisation on this model in the future."
|
82 |
),
|
83 |
-
allow_flagging="never"
|
|
|
84 |
)
|
85 |
|
86 |
interface.launch(share=True)
|
|
|
4 |
from PIL import Image
|
5 |
import google.generativeai as genai
|
6 |
import os
|
7 |
+
import markdown2
|
8 |
|
9 |
# Load the TensorFlow model
|
10 |
model_path = 'model'
|
|
|
26 |
)
|
27 |
try:
|
28 |
response = genai.GenerativeModel("gemini-1.5-flash").generate_content(prompt)
|
29 |
+
return markdown2.markdown(response.text.strip())
|
30 |
except Exception as e:
|
31 |
return f"Error: {e}"
|
32 |
|
|
|
56 |
["exp_eye_images/image_1002_g.jpg"]
|
57 |
]
|
58 |
|
59 |
+
# Custom CSS for HTML height
|
60 |
css = """
|
61 |
+
.scrollable-html {
|
62 |
+
height: 200px; /* Adjust this height as needed */
|
63 |
+
overflow-y: auto; /* Enable vertical scrolling */
|
64 |
+
border: 1px solid #ccc; /* Optional: border for visibility */
|
65 |
+
padding: 10px; /* Optional: padding for content */
|
66 |
+
box-sizing: border-box; /* Include padding in height calculation */
|
67 |
}
|
68 |
"""
|
69 |
|
|
|
73 |
inputs=gr.Image(type="pil"),
|
74 |
outputs=[
|
75 |
gr.Label(num_top_classes=1, label="Prediction"),
|
76 |
+
gr.HTML(label="Explanation", elem_classes=["scrollable-html"]))
|
77 |
],
|
78 |
examples=example_images,
|
79 |
title="Eye Diseases Classifier",
|
|
|
81 |
"Upload an image of an eye fundus, and the model will predict it.\n\n"
|
82 |
"**Disclaimer:** This model is intended as a form of learning process in the field of health-related machine learning and was trained with a limited amount and variety of data with a total of about 4000 data, so the prediction results may not always be correct. There is still a lot of room for improvisation on this model in the future."
|
83 |
),
|
84 |
+
allow_flagging="never",
|
85 |
+
css=css
|
86 |
)
|
87 |
|
88 |
interface.launch(share=True)
|