Broomva commited on
Commit
5d2f16c
·
1 Parent(s): 12c8edb

added spa-guc model

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -2,6 +2,9 @@ import random
2
  import time
3
 
4
  import gradio as gr
 
 
 
5
 
6
  with gr.Blocks() as demo:
7
  chatbot = gr.Chatbot()
@@ -12,7 +15,8 @@ with gr.Blocks() as demo:
12
  return "", history + [[user_message, None]]
13
 
14
  def bot(history):
15
- bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
 
16
  history[-1][1] = ""
17
  for character in bot_message:
18
  history[-1][1] += character
 
2
  import time
3
 
4
  import gradio as gr
5
+ from transformers import pipeline
6
+
7
+ translator = pipeline("translation", model=f'Broomva/bart-large-translation-spa-guc')
8
 
9
  with gr.Blocks() as demo:
10
  chatbot = gr.Chatbot()
 
15
  return "", history + [[user_message, None]]
16
 
17
  def bot(history):
18
+ #bot_message = random.choice(["How are you?", "I love you", "I'm very hungry"])
19
+ bot_message = translator(history)[0]['translation_text']
20
  history[-1][1] = ""
21
  for character in bot_message:
22
  history[-1][1] += character