Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -10,9 +10,12 @@ from threading import Thread
|
|
10 |
from transformers import pipeline
|
11 |
import emoji
|
12 |
|
13 |
-
ru2en =
|
14 |
-
def translate(text):
|
15 |
-
return ru2en(text)[0]["translation_text"]
|
|
|
|
|
|
|
16 |
|
17 |
text_gen=gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion")
|
18 |
def get_prompts(prompt_text):
|
@@ -111,7 +114,7 @@ with gr.Blocks(css='style.css') as demo:
|
|
111 |
run4 = gr.Button("Generate").style(full_width=False)
|
112 |
output4=gr.Image()
|
113 |
|
114 |
-
Translate.click(
|
115 |
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt], queue=False)
|
116 |
run1.click(send_it, inputs=[prompt, noise_level], outputs=[output1])
|
117 |
run2.click(send_it, inputs=[prompt, noise_level], outputs=[output2])
|
|
|
10 |
from transformers import pipeline
|
11 |
import emoji
|
12 |
|
13 |
+
ru2en = gr.Interface.load("huggingface/Helsinki-NLP/opus-mt-ru-en")
|
14 |
+
# def translate(text):
|
15 |
+
# return ru2en(text)[0]["translation_text"]
|
16 |
+
|
17 |
+
# def translate(inputs, noise_level, ru2en=ru2en):
|
18 |
+
# return ru2en(prompt_with_noise)#[0]["translation_text"]
|
19 |
|
20 |
text_gen=gr.Interface.load("spaces/phenomenon1981/MagicPrompt-Stable-Diffusion")
|
21 |
def get_prompts(prompt_text):
|
|
|
114 |
run4 = gr.Button("Generate").style(full_width=False)
|
115 |
output4=gr.Image()
|
116 |
|
117 |
+
Translate.click(ru2en, inputs=[input_text_ru], outputs=[input_text], queue=False)
|
118 |
see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt], queue=False)
|
119 |
run1.click(send_it, inputs=[prompt, noise_level], outputs=[output1])
|
120 |
run2.click(send_it, inputs=[prompt, noise_level], outputs=[output2])
|