Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,19 +1,14 @@
|
|
1 |
import gradio as gr
|
2 |
-
from fastai.learner import load_learner
|
3 |
from fastai.vision.core import PILImage
|
|
|
4 |
|
5 |
-
# Cargar el
|
6 |
-
|
7 |
-
learn = load_learner(model_path)
|
8 |
|
9 |
def predict(img):
|
10 |
pred_class, pred_idx, probs = learn.predict(PILImage.create(img))
|
11 |
return f"Clase Predicha: {pred_class}, Probabilidad: {probs[pred_idx]:.4f}"
|
12 |
|
13 |
-
|
14 |
-
demo = gr.Interface(fn=predict,
|
15 |
-
inputs=gr.Image(type="pil"),
|
16 |
-
outputs="text")
|
17 |
-
|
18 |
-
# Ejecutar la aplicaci贸n
|
19 |
demo.launch()
|
|
|
|
1 |
import gradio as gr
|
|
|
2 |
from fastai.vision.core import PILImage
|
3 |
+
from huggingface_hub import from_pretrained_fastai
|
4 |
|
5 |
+
# Cargar directamente desde el repositorio en Hugging Face
|
6 |
+
learn = from_pretrained_fastai("jeancguerrero/fastai-simple-climate") # o el nombre que corresponda
|
|
|
7 |
|
8 |
def predict(img):
|
9 |
pred_class, pred_idx, probs = learn.predict(PILImage.create(img))
|
10 |
return f"Clase Predicha: {pred_class}, Probabilidad: {probs[pred_idx]:.4f}"
|
11 |
|
12 |
+
demo = gr.Interface(fn=predict, inputs=gr.Image(type="pil"), outputs="text")
|
|
|
|
|
|
|
|
|
|
|
13 |
demo.launch()
|
14 |
+
|