Spaces:
Runtime error
Runtime error
File size: 634 Bytes
438eda1 d7c2c45 438eda1 2c5b242 438eda1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
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-en-de")
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 out
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()
|