saifarko commited on
Commit
5f05cbc
·
verified ·
1 Parent(s): 2c651dc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +30 -7
app.py CHANGED
@@ -1,7 +1,30 @@
1
- import gradio as gr
2
-
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from PIL import Image
3
+ import tensorflow as tf
4
+ import numpy as np
5
+
6
+ # Model load koro (example: EfficientNetB3)
7
+ model = tf.keras.models.load_model("model.h5") # model.h5 file upload koro
8
+
9
+ # Class names (modify koro jodi dorkar hoy)
10
+ class_names = ["Monkeypox", "Not Monkeypox"]
11
+
12
+ def predict(image):
13
+ # Image resize & preprocess (modify koro jodi dorkar hoy)
14
+ img = image.resize((224, 224))
15
+ img = np.array(img) / 255.0
16
+ img = np.expand_dims(img, axis=0)
17
+ pred = model.predict(img)
18
+ label = class_names[np.argmax(pred)]
19
+ confidence = np.max(pred)
20
+ return f"{label} ({confidence*100:.2f}%)"
21
+
22
+ iface = gr.Interface(
23
+ fn=predict,
24
+ inputs=gr.Image(type="pil"),
25
+ outputs="text",
26
+ title="Monkeypox Detection",
27
+ description="Upload a skin image to check for Monkeypox."
28
+ )
29
+
30
+ iface.launch()