File size: 607 Bytes
44acfb5
 
 
0f53fb8
44acfb5
 
a81178a
44acfb5
 
 
c31089d
fb2464b
a81178a
 
44acfb5
 
c31089d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from huggingface_hub import from_pretrained_fastai
import gradio as gr
from fastai.vision.all import *
from fastai.vision.gan import *


learn = load_learner("modeloFotos")

# Definimos una función que se encarga de llevar a cabo las predicciones
def predict(img):
    img = PILImage.create(img)
    img=np.array(learn.predict(img)[0]).reshape((128,128,3))
    
    return Image.fromarray(img.astype("uint8"))
    
# Creamos la interfaz y la lanzamos. 
gr.Interface(fn=predict,  inputs=gr.inputs.Image(type="filepath"), outputs=gr.outputs.Image(type="pil"),examples=['f1.jpg','f2.jpg']).launch(share=False)