Spaces:
Sleeping
Sleeping
Update requirements.txt
Browse files- requirements.txt +8 -53
requirements.txt
CHANGED
|
@@ -1,55 +1,10 @@
|
|
| 1 |
huggingface_hub==0.25.2
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
memory = ConversationMemory()
|
| 13 |
-
|
| 14 |
-
# Logic
|
| 15 |
-
def chat(user_text=None, record_audio_flag=False):
|
| 16 |
-
if record_audio_flag:
|
| 17 |
-
user_text = record_audio()
|
| 18 |
-
|
| 19 |
-
if not user_text:
|
| 20 |
-
return "No input detected.", None
|
| 21 |
-
|
| 22 |
-
# 1. Predict mental state
|
| 23 |
-
eeg_features = simulate_eeg_data()
|
| 24 |
-
mental_state = predict_mental_state(eeg_features)
|
| 25 |
-
|
| 26 |
-
# 2. Generate response with memory
|
| 27 |
-
history = memory.get_formatted_history()
|
| 28 |
-
ai_response = generate_response(mental_state, user_text, history)
|
| 29 |
-
|
| 30 |
-
# 3. Update memory
|
| 31 |
-
memory.add_exchange(user_input=user_text, bot_response=ai_response)
|
| 32 |
-
|
| 33 |
-
# 4. Nigerian Accent TTS
|
| 34 |
-
nigerian_accent_tts(ai_response, mental_state)
|
| 35 |
-
|
| 36 |
-
return ai_response, "response.mp3"
|
| 37 |
-
|
| 38 |
-
# Gradio app
|
| 39 |
-
with gr.Blocks() as demo:
|
| 40 |
-
gr.Markdown("# EEG Mental State Chatbot with Nigerian Voice (Upgraded)")
|
| 41 |
-
|
| 42 |
-
with gr.Row():
|
| 43 |
-
user_input = gr.Textbox(label="Type your message")
|
| 44 |
-
record_audio_flag = gr.Checkbox(label="Use Microphone?", value=False)
|
| 45 |
-
|
| 46 |
-
with gr.Row():
|
| 47 |
-
submit_btn = gr.Button("Send")
|
| 48 |
-
|
| 49 |
-
with gr.Row():
|
| 50 |
-
chatbot_response = gr.Textbox(label="Chatbot response")
|
| 51 |
-
chatbot_audio = gr.Audio(label="Chatbot voice", type="filepath")
|
| 52 |
-
|
| 53 |
-
submit_btn.click(chat, inputs=[user_input, record_audio_flag], outputs=[chatbot_response, chatbot_audio])
|
| 54 |
-
|
| 55 |
-
demo.launch()
|
|
|
|
| 1 |
huggingface_hub==0.25.2
|
| 2 |
|
| 3 |
+
gradio
|
| 4 |
+
speechrecognition
|
| 5 |
+
pyaudio
|
| 6 |
+
gtts
|
| 7 |
+
playsound
|
| 8 |
+
joblib
|
| 9 |
+
scikit-learn
|
| 10 |
+
transformers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|