Spaces:
Running
Running
import gradio as gr | |
from transformers import pipeline | |
title= "German Flan-T5" | |
examples = [ | |
["Erzähl mit eine Geschichte!"] | |
] | |
tDeEn = pipeline(model="Helsinki-NLP/opus-mt-de-en") | |
tEnDe = pipeline(model="Helsinki-NLP/opus-mt-de-en") | |
bot = pipeline(model="google/flan-t5-large") | |
def solve(text): | |
eng=tDeEn(text)[0]["translation_text"] | |
out=bot(eng,max_length=50)[0]["generated_text"] | |
out=tEnDe(out)[0]["translation_text"] | |
return output | |
task = gr.Interface( | |
fn=solve, | |
inputs=gr.Textbox(lines=5,max_lines=6,label="Auftrag:"), | |
outputs="text", | |
title=title, | |
examples=examples | |
) | |
if __name__ == "__main__": | |
task.launch() | |