VaneM commited on
Commit
c8bf840
1 Parent(s): a1278e1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -15
app.py CHANGED
@@ -1,23 +1,16 @@
1
  import gradio as gr
2
- from transformers import pipeline
3
 
4
- # Cargamos el modelo traductor y creamos el pipeline para traducir al ingles
5
- spanish_model_name = "Helsinki-NLP/opus-mt-es-en"
6
- translator_es_en = pipeline("translation", model=spanish_model_name)
7
 
8
- def translate(text):
9
- prompt_es = text
10
- english_text = translator_es_en(prompt_es)
11
- prompt_en = english_text[0]['translation_text']
12
- return prompt_en
13
-
14
- title="Texto a Imagen en Español con Stable Diffusion 2.0"
15
  article = """
16
  El modelo usa:
17
  - Texto a Imagen [Stable Diffusion 2.0](https://huggingface.co/stabilityai/stable-diffusion-2),
18
- - Para las traducciones [Helsinki-NLP](https://huggingface.co/Helsinki-NLP)
19
  \n ... y mucha magia ☺
20
  """
21
- gr.Interface(fn=translate,
22
- inputs= gr.Textbox("", max_lines = 2, label = "Inserte su texto aqui"),
23
- outputs = "text").load("models/stabilityai/stable-diffusion-2", title = title, article=article).launch(debug=True)
 
 
 
1
  import gradio as gr
 
2
 
 
 
 
3
 
4
+ title="Texto a Imagen con Stable Diffusion 2.0"
5
+ description = '<h2 style="text-align:center">Prompt en Español!</h2>'
 
 
 
 
 
6
  article = """
7
  El modelo usa:
8
  - Texto a Imagen [Stable Diffusion 2.0](https://huggingface.co/stabilityai/stable-diffusion-2),
9
+ - Para la traduccion [Helsinki-NLP](https://huggingface.co/Helsinki-NLP)
10
  \n ... y mucha magia ☺
11
  """
12
+
13
+ text_imagen = gr.Interface.load("models/stabilityai/stable-diffusion-2")
14
+ text_translate = gr.Interface.load("models/Helsinki-NLP/opus-mt-es-en")
15
+
16
+ gr.Series(text_translate, text_imagen, title=title, description = description, article=article).launch(debug=True)