File size: 404 Bytes
07d3391
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 27 15:20:50 2022

@author: vblanco
"""

import gradio as gr
from transformers import pipeline

pipe = pipeline("fill-mask", model="dccuchile/bert-base-spanish-wwm-uncased")

def predict(text):
 return pipe(text)['token_str']

iface = gr.Interface(
  fn=predict, 
  inputs='text',
  outputs='text',
  examples=[["Hello! My [MASK] is Omar"]]
)

iface.launch()