from transformers import pipeline | |
import gradio as gr | |
translator = pipeline('text2text-generation', model='edgilr/mbart-neutralization') | |
def predict(txt): | |
return translator(txt)[0]['generated_text'] | |
gr.Interface(fn=predict, inputs="text", outputs="text", | |
examples=['You are an AI assistant. User will you give you a task. Your goal is to complete the task as faithfully as you can. While performing the task think step-by-step and justify your steps.']).launch(share=True) |