Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import tensorflow as tf
|
| 3 |
+
|
| 4 |
+
model = tf.keras.models.load_model("hf://JaviSwift/cifar10_simple") # Cambia esto por tu usuario y nombre del modelo
|
| 5 |
+
|
| 6 |
+
def predict(image):
|
| 7 |
+
image = tf.image.resize(image, (32, 32)) # Ajusta seg煤n tu modelo
|
| 8 |
+
image = image / 255.0 # Normaliza si es necesario
|
| 9 |
+
image = tf.expand_dims(image, axis=0) # A帽ade dimensi贸n para batch
|
| 10 |
+
|
| 11 |
+
predictions = model.predict(image)
|
| 12 |
+
return predictions.argmax(axis=1)[0] # Devuelve la clase predicha
|
| 13 |
+
|
| 14 |
+
iface = gr.Interface(fn=predict, inputs="image", outputs="label")
|
| 15 |
+
iface.launch()
|