Futuresony commited on
Commit
9aacde7
·
verified ·
1 Parent(s): 14e0605

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
app.py CHANGED
@@ -36,7 +36,7 @@ def respond(
36
  yield response
37
 
38
 
39
- # Custom HTML for mic button and input box
40
  mic_html = """
41
  <div class="mic-container">
42
  <button id="mic_button" title="Click to speak">
@@ -133,22 +133,24 @@ if ('webkitSpeechRecognition' in window) {
133
  """
134
 
135
  # Gradio Chat Interface with Mic Button
136
- demo = gr.ChatInterface(
137
- fn=respond,
138
- additional_inputs=[
139
- gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
140
- gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
141
- gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
142
- gr.Slider(
143
- minimum=0.1,
144
- maximum=1.0,
145
- value=0.95,
146
- step=0.05,
147
- label="Top-p (nucleus sampling)",
148
- ),
149
- ],
150
- )
151
- demo.load(_js=mic_html)
 
152
 
153
  if __name__ == "__main__":
154
  demo.launch()
 
 
36
  yield response
37
 
38
 
39
+ # Custom HTML and JS for mic button and speech-to-text
40
  mic_html = """
41
  <div class="mic-container">
42
  <button id="mic_button" title="Click to speak">
 
133
  """
134
 
135
  # Gradio Chat Interface with Mic Button
136
+ with gr.Blocks() as demo:
137
+ gr.HTML(mic_html)
138
+ chatbot = gr.ChatInterface(
139
+ fn=respond,
140
+ additional_inputs=[
141
+ gr.Textbox(value="You are a friendly Chatbot.", label="System message"),
142
+ gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
143
+ gr.Slider(minimum=0.1, maximum=4.0, value=0.7, step=0.1, label="Temperature"),
144
+ gr.Slider(
145
+ minimum=0.1,
146
+ maximum=1.0,
147
+ value=0.95,
148
+ step=0.05,
149
+ label="Top-p (nucleus sampling)",
150
+ ),
151
+ ],
152
+ )
153
 
154
  if __name__ == "__main__":
155
  demo.launch()
156
+