Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -60,10 +60,8 @@ def get_bot_response(query):
|
|
60 |
# Gradio interface function
|
61 |
def chatbot(audio, message, system_message, max_tokens, temperature, top_p):
|
62 |
if audio is not None:
|
63 |
-
|
64 |
-
|
65 |
-
f.write(audio.read())
|
66 |
-
|
67 |
# Transcribe the audio using Whisper
|
68 |
transcript = transcribe_audio("temp.wav")
|
69 |
message = transcript # Use the transcript as the input message
|
@@ -80,7 +78,7 @@ def chatbot(audio, message, system_message, max_tokens, temperature, top_p):
|
|
80 |
demo = gr.Interface(
|
81 |
fn=chatbot,
|
82 |
inputs=[
|
83 |
-
gr.Audio(type="numpy", label="Speak to the Bot"
|
84 |
gr.Textbox(value="How can I help you?", label="Text Input (optional)"),
|
85 |
gr.Textbox(value="You are a friendly chatbot.", label="System message"),
|
86 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|
|
|
60 |
# Gradio interface function
|
61 |
def chatbot(audio, message, system_message, max_tokens, temperature, top_p):
|
62 |
if audio is not None:
|
63 |
+
audio_data, sample_rate = audio
|
64 |
+
sf.write("temp.wav", audio_data, sample_rate)
|
|
|
|
|
65 |
# Transcribe the audio using Whisper
|
66 |
transcript = transcribe_audio("temp.wav")
|
67 |
message = transcript # Use the transcript as the input message
|
|
|
78 |
demo = gr.Interface(
|
79 |
fn=chatbot,
|
80 |
inputs=[
|
81 |
+
gr.Audio(source="microphone",type="numpy", label="Speak to the Bot"), # Adjusted for microphone input
|
82 |
gr.Textbox(value="How can I help you?", label="Text Input (optional)"),
|
83 |
gr.Textbox(value="You are a friendly chatbot.", label="System message"),
|
84 |
gr.Slider(minimum=1, maximum=2048, value=512, step=1, label="Max new tokens"),
|