AFischer1985 commited on
Commit
438eda1
1 Parent(s): 4487f78

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from transformers import pipeline
3
+ title= "German Flan-T5"
4
+ examples = [
5
+ ["Erzähl mit eine Geschichte!"]
6
+ ]
7
+
8
+ tDeEn = pipeline(model="Helsinki-NLP/opus-mt-de-en")
9
+ tEnDe = pipeline(model="Helsinki-NLP/opus-mt-de-en")
10
+ bot = pipeline(model="google/flan-t5-large")
11
+
12
+ def solve(text):
13
+ eng=tDeEn(text)[0]["translation_text"]
14
+ out=bot(eng,max_length=50)[0]["generated_text"]
15
+ out=tEnDe(out)[0]["translation_text"]
16
+ return output
17
+
18
+ task = gr.Interface(
19
+ fn=solve,
20
+ inputs=gr.Textbox(lines=5,max_lines=6,label="Auftrag:"),
21
+ outputs="text",
22
+ title=title,
23
+ examples=examples
24
+ )
25
+
26
+ if __name__ == "__main__":
27
+ task.launch()