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)