Spaces:
Starting on Zero
Starting on Zero
Commit ·
c8b7fcf
1
Parent(s): 3cbdf32
add transcription box
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ system_prompt = """"<s>[INST] You are Friday, a helpful and conversational AI as
|
|
| 15 |
|
| 16 |
chat_history = system_prompt + """"""
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
client = InferenceClient(LLM_MODEL_NAME)
|
| 21 |
|
|
@@ -71,11 +71,9 @@ def transcribe(audio):
|
|
| 71 |
audio_response = gTTS(llm_response)
|
| 72 |
audio_response.save("response.mp3")
|
| 73 |
|
| 74 |
-
print(formatted_history)
|
| 75 |
-
|
| 76 |
print(chat_history)
|
| 77 |
|
| 78 |
-
return "response.mp3"
|
| 79 |
|
| 80 |
|
| 81 |
with gr.Blocks() as demo:
|
|
@@ -89,10 +87,12 @@ with gr.Blocks() as demo:
|
|
| 89 |
elem_classes="audio")
|
| 90 |
|
| 91 |
transcribe_btn = gr.Button("Transcribe")
|
| 92 |
-
|
| 93 |
-
|
|
|
|
| 94 |
|
| 95 |
-
|
|
|
|
| 96 |
|
| 97 |
|
| 98 |
demo.queue()
|
|
|
|
| 15 |
|
| 16 |
chat_history = system_prompt + """"""
|
| 17 |
|
| 18 |
+
formatted_history = """"""
|
| 19 |
|
| 20 |
client = InferenceClient(LLM_MODEL_NAME)
|
| 21 |
|
|
|
|
| 71 |
audio_response = gTTS(llm_response)
|
| 72 |
audio_response.save("response.mp3")
|
| 73 |
|
|
|
|
|
|
|
| 74 |
print(chat_history)
|
| 75 |
|
| 76 |
+
return "response.mp3", formatted_history
|
| 77 |
|
| 78 |
|
| 79 |
with gr.Blocks() as demo:
|
|
|
|
| 87 |
elem_classes="audio")
|
| 88 |
|
| 89 |
transcribe_btn = gr.Button("Transcribe")
|
| 90 |
+
|
| 91 |
+
transcription_box = gr.Textbox(
|
| 92 |
+
formatted_history, label="Transcription")
|
| 93 |
|
| 94 |
+
transcribe_btn.click(fn=transcribe, inputs=audio_input,
|
| 95 |
+
outputs=[output_audio, transcription_box])
|
| 96 |
|
| 97 |
|
| 98 |
demo.queue()
|