Krlos02 commited on
Commit
fe6676d
verified
1 Parent(s): 4eefe21

Subido modelo corregido

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +35 -0
  3. model.keras +3 -0
.gitattributes CHANGED
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ model.keras filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import tensorflow as tf
3
+ from PIL import Image
4
+ import numpy as np
5
+
6
+ # Cargamos el modelo guardado
7
+ model = tf.keras.models.load_model("model.keras")
8
+
9
+ # Tus clases
10
+ labels = ['pituitary', 'meningioma', 'notumor', 'glioma']
11
+
12
+ # Preprocesamiento (ajustado al modelo Deit-Tiny 224x224)
13
+ IMG_SIZE = (224, 224)
14
+
15
+ def predict(image):
16
+ # Convertimos a array
17
+ img = image.resize(IMG_SIZE)
18
+ img = np.array(img) / 255.0
19
+ img = np.expand_dims(img, axis=0)
20
+
21
+ # Predicci贸n
22
+ preds = model.predict(img)[0]
23
+ probs = {labels[i]: float(preds[i]) for i in range(len(labels))}
24
+
25
+ return probs
26
+
27
+ interface = gr.Interface(
28
+ fn=predict,
29
+ inputs=gr.Image(type="pil", label="Sube una imagen"),
30
+ outputs=gr.Label(num_top_classes=4, label="Predicci贸n"),
31
+ title="Clasificador de Tumores Cerebrales",
32
+ description="Clasificador entrenado en 4 categor铆as: pituitary, meningioma, notumor, glioma"
33
+ )
34
+
35
+ interface.launch()
model.keras ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:194e1eed276e0316e6351b8e7bcee2ae66670a4fc7b795093b4f911fe6113a61
3
+ size 4926205