Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -58,21 +58,20 @@ def transcribe(audio, past_history):
|
|
58 |
y = y.astype(np.float32)
|
59 |
y /= np.max(np.abs(y))
|
60 |
|
61 |
-
# Transcribe user audio
|
62 |
transcribed_user_audio = pipe({"sampling_rate": sr, "raw": y})["text"]
|
63 |
|
64 |
-
# Append user input to history
|
65 |
-
formatted_history += past_history
|
66 |
formatted_history += f"π Human: {transcribed_user_audio}\n\n"
|
67 |
instruct_history += f"<s>[INST] {transcribed_user_audio} [/INST] "
|
68 |
|
69 |
# Generate LLM response
|
70 |
llm_response = generate(instruct_history)
|
71 |
|
72 |
-
# Append AI response to history
|
73 |
instruct_history += f" {llm_response}</s>"
|
74 |
formatted_history += f"π€ Friday: {llm_response}\n\n"
|
75 |
|
|
|
|
|
|
|
76 |
# Convert AI response to audio
|
77 |
audio_response = gTTS(llm_response)
|
78 |
audio_response.save("response.mp3")
|
|
|
58 |
y = y.astype(np.float32)
|
59 |
y /= np.max(np.abs(y))
|
60 |
|
|
|
61 |
transcribed_user_audio = pipe({"sampling_rate": sr, "raw": y})["text"]
|
62 |
|
|
|
|
|
63 |
formatted_history += f"π Human: {transcribed_user_audio}\n\n"
|
64 |
instruct_history += f"<s>[INST] {transcribed_user_audio} [/INST] "
|
65 |
|
66 |
# Generate LLM response
|
67 |
llm_response = generate(instruct_history)
|
68 |
|
|
|
69 |
instruct_history += f" {llm_response}</s>"
|
70 |
formatted_history += f"π€ Friday: {llm_response}\n\n"
|
71 |
|
72 |
+
formatted_history += past_history
|
73 |
+
|
74 |
+
|
75 |
# Convert AI response to audio
|
76 |
audio_response = gTTS(llm_response)
|
77 |
audio_response.save("response.mp3")
|