DiamondYin commited on
Commit
424273b
·
1 Parent(s): 50dee91

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -21,12 +21,12 @@ BUZZ_TIMEOUT = 60
21
  GENERAL_RSPONSE_TRIGGERS = ["I don't understand the question.", "I don't know", "Hello, my name is", "mentioned in the context provided"]
22
  MESSAGES = [{"role": "system", "content": "You are a helpful assistant.."}]
23
 
24
- LOGGER = logging.getLogger('voice_agent')
25
  AUDIO_HTML = ''
26
 
27
  # Uncomment If this is your first Run:
28
- nltk.download('averaged_perceptron_tagger')
29
- conv_model, voice_model = initialize_knowledge_base()
30
 
31
 
32
  def idle_timer():
@@ -114,8 +114,8 @@ with gr.Blocks(title="Your Assistance Pal!") as demo:
114
  with gr.Row():
115
  msg = gr.Textbox(placeholder='Write a chat & press Enter.', show_label=False).style(container=False)
116
  with gr.Column(scale=0.5):
117
- audio_input = gr.Audio(source="microphone", type='filepath', show_label=False).style(container=False)
118
- button = gr.Button(value="Send")
119
 
120
  msg.submit(get_chat_history, [msg, chatbot], [msg, chatbot]
121
  ).then(update_img, outputs=[assistant_character]
 
21
  GENERAL_RSPONSE_TRIGGERS = ["I don't understand the question.", "I don't know", "Hello, my name is", "mentioned in the context provided"]
22
  MESSAGES = [{"role": "system", "content": "You are a helpful assistant.."}]
23
 
24
+ LOGGER = logging.getLogger('voice_agent') # logger object
25
  AUDIO_HTML = ''
26
 
27
  # Uncomment If this is your first Run:
28
+ nltk.download('averaged_perceptron_tagger') #download the nltk model
29
+ conv_model, voice_model = initialize_knowledge_base() # initialize the knowledge base
30
 
31
 
32
  def idle_timer():
 
114
  with gr.Row():
115
  msg = gr.Textbox(placeholder='Write a chat & press Enter.', show_label=False).style(container=False)
116
  with gr.Column(scale=0.5):
117
+ audio_input = gr.Audio(source="microphone", type='filepath', show_label=False).style(container=False) # audio input
118
+ button = gr.Button(value="Send") # button to send the message
119
 
120
  msg.submit(get_chat_history, [msg, chatbot], [msg, chatbot]
121
  ).then(update_img, outputs=[assistant_character]