Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
deToEng = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-tr-en")
|
3 |
+
text_to_image = gr.Interface.load("huggingface/runwayml/stable-diffusion-v1-5")
|
4 |
+
|
5 |
+
with gr.Blocks() as demo:
|
6 |
+
title = "Translate from German to English and English text to image"
|
7 |
+
|
8 |
+
de_text = gr.Textbox(placeholder="Almanca cümle")
|
9 |
+
translate_btn = gr.Button("translate from german to english")
|
10 |
+
|
11 |
+
eng_text = gr.Textbox(label="ingilizce")
|
12 |
+
translate_btn.click(deToEng, de_text, eng_text)
|
13 |
+
|
14 |
+
text_to_image_btn = gr.Button("text to image")
|
15 |
+
|
16 |
+
out = gr.Image()
|
17 |
+
|
18 |
+
text_to_image_btn.click(text_to_image, eng_text, out)
|
19 |
+
|
20 |
+
demo.launch(share=True)
|
21 |
+
|