Practica8 / app.py
lauragordo's picture
Update app.py
e3e07e5 verified
raw
history blame contribute delete
502 Bytes
import pandas as pd
from fastai.text.all import *
try:
import transformers
except ImportError:
os.system('pip install transformers')
import transformers
import gradio as gr
from transformers import pipeline
repo_id = "lauragordo/mbart-traduct"
traduct = pipeline('text2text-generation', model=repo_id)
def predict(texto):
return traduct(texto)
gr.Interface(fn=predict, inputs="textbox", outputs="textbox", examples=["When is your birthday", "i like flowers"]).launch(share=True)