Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from fastai.vision.all import unet_learner, resnet34, load_learner
|
2 |
+
|
3 |
+
learn = load_learner("unet_export.pkl")
|
4 |
+
|
5 |
+
def segment_image(img):
|
6 |
+
pred, _, _ = learn.predict(img)
|
7 |
+
return pred
|
8 |
+
|
9 |
+
# Crear interfaz Gradio
|
10 |
+
interface = gr.Interface(
|
11 |
+
fn=segment_image,
|
12 |
+
inputs=gr.Image(type="pil"),
|
13 |
+
outputs=gr.Image(type="numpy"),
|
14 |
+
title="Segmentaci贸n Sem谩ntica con FastAI",
|
15 |
+
)
|
16 |
+
|
17 |
+
interface.launch()
|