Spaces:
Sleeping
Sleeping
Upload 3 files
Browse filesPrimera version
- .gitattributes +1 -0
- app.py +35 -0
- pizza_vs_steak_gdct_intento1.keras +3 -0
- requirements.txt +4 -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 |
+
pizza_vs_steak_gdct_intento1.keras filter=lfs diff=lfs merge=lfs -text
|
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
"""pizzasteakui.ipynb
|
| 3 |
+
|
| 4 |
+
Automatically generated by Colab.
|
| 5 |
+
|
| 6 |
+
Original file is located at
|
| 7 |
+
https://colab.research.google.com/drive/1XnRBo2y4xWrz-NBRR5hd8jV-PbNvbvbK
|
| 8 |
+
"""
|
| 9 |
+
|
| 10 |
+
import gradio as gr
|
| 11 |
+
import numpy as np
|
| 12 |
+
from PIL import Image
|
| 13 |
+
import tensorflow as tf
|
| 14 |
+
|
| 15 |
+
modelo = tf.keras.models.load_model("./pizza_vs_steak_gdct_intento1.keras")
|
| 16 |
+
|
| 17 |
+
# prompt: usando gradio, generar una interfaz para subir una imagen
|
| 18 |
+
|
| 19 |
+
import numpy as np
|
| 20 |
+
def predict_image(img):
|
| 21 |
+
img = Image.fromarray(img.astype('uint8'), 'RGB') # Ensure image is in correct format
|
| 22 |
+
img = img.resize((128, 128)) # Resize to model input size
|
| 23 |
+
img_array = np.array(img) / 255.0 # Normalize
|
| 24 |
+
img_array = np.expand_dims(img_array, axis=0) # Add batch dimension
|
| 25 |
+
prediction = modelo.predict(img_array)
|
| 26 |
+
print(prediction)
|
| 27 |
+
# Assuming the model outputs a single value probability for one class (e.g., steak)
|
| 28 |
+
# You might need to adjust this based on your model's output layer
|
| 29 |
+
if prediction[0] > 0.5:
|
| 30 |
+
return "Steak"
|
| 31 |
+
else:
|
| 32 |
+
return "Pizza"
|
| 33 |
+
|
| 34 |
+
iface = gr.Interface(fn=predict_image, inputs="image", outputs="text", title="Pizza vs Steak Classifier")
|
| 35 |
+
iface.launch()
|
pizza_vs_steak_gdct_intento1.keras
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1d3fc5a584db7fe352515a6e835f49dccd44d113c3253f6fa5fc76bb740d8f01
|
| 3 |
+
size 17060466
|
requirements.txt
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio
|
| 2 |
+
tensorflow
|
| 3 |
+
numpy
|
| 4 |
+
PIL
|