Spaces:
Sleeping
Sleeping
Delete app.py
Browse files
app.py
DELETED
|
@@ -1,38 +0,0 @@
|
|
| 1 |
-
# app.py β UI with voice-enabled chatbot
|
| 2 |
-
import gradio as gr
|
| 3 |
-
from agent import chat_with_agent, handle_voice # π Import both text and audio handlers
|
| 4 |
-
# from agent import chat_with_agent, transcribe_audio_to_text
|
| 5 |
-
from memory_manager import memory_manager
|
| 6 |
-
|
| 7 |
-
with gr.Blocks() as demo:
|
| 8 |
-
gr.Markdown("# π§ Chat with Companion")
|
| 9 |
-
|
| 10 |
-
with gr.Tab("Chat with Companion"):
|
| 11 |
-
chatbot = gr.Chatbot()
|
| 12 |
-
msg = gr.Textbox(label="Type your message here")
|
| 13 |
-
response_audio = gr.Audio(label="Companion Voice", type="filepath") # π Audio player
|
| 14 |
-
clear = gr.Button("Clear")
|
| 15 |
-
|
| 16 |
-
# π Submit button handles text + voice output
|
| 17 |
-
msg.submit(chat_with_agent, [msg, chatbot], [msg, chatbot, response_audio])
|
| 18 |
-
clear.click(lambda: None, None, chatbot, queue=False)
|
| 19 |
-
|
| 20 |
-
gr.Markdown("### Or speak your message") # π Voice input section
|
| 21 |
-
audio_input = gr.Audio(type="filepath", label="π€ Voice Input") # π Mic recorder
|
| 22 |
-
transcribe_btn = gr.Button("Transcribe and Send")
|
| 23 |
-
transcribe_btn.click(handle_voice, [audio_input, chatbot], [chatbot, response_audio]) # π voice submit
|
| 24 |
-
|
| 25 |
-
with gr.Tab("Memory Manager"):
|
| 26 |
-
memory_manager.render()
|
| 27 |
-
|
| 28 |
-
with gr.Tab("Upload Script & Settings"):
|
| 29 |
-
with gr.Column():
|
| 30 |
-
gr.Markdown("### Upload a Custom Script or Past Conversation")
|
| 31 |
-
# upload_script = gr.File(file_types=[".txt", ".jsonl"], label="Upload Script File")
|
| 32 |
-
gr.File(file_types=[".txt", ".jsonl"], label="Upload Script File")
|
| 33 |
-
gr.Markdown("### Settings")
|
| 34 |
-
gr.Checkbox(label="Enable Fictional Memory Grounding", value=True)
|
| 35 |
-
gr.Radio(["Empathetic", "Neutral", "Factual"], label="Chatbot Tone", value="Empathetic")
|
| 36 |
-
|
| 37 |
-
# Launch the app
|
| 38 |
-
demo.launch()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|