Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -92,7 +92,7 @@ textarea, input[type='text'] { border: 1px solid #ccc; border-radius: 20px; padd
|
|
92 |
with gr.Column(scale=1):
|
93 |
gr.Markdown("<h2 style='text-align:center;'>Chats</h2>")
|
94 |
new_chat = gr.Button("π New Chat")
|
95 |
-
|
96 |
|
97 |
with gr.Column(scale=3):
|
98 |
gr.Markdown("<h1 style='text-align:center;'>Neobot</h1>")
|
@@ -104,10 +104,13 @@ textarea, input[type='text'] { border: 1px solid #ccc; border-radius: 20px; padd
|
|
104 |
file_input = gr.File(file_types=[".mp3", ".wav"], visible=False)
|
105 |
|
106 |
def update_chat_list():
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
|
|
|
|
|
|
111 |
|
112 |
send = gr.Button("Send π")
|
113 |
send.click(chat_with_groq, inputs=[chat_input, state], outputs=[chat_input, chatbot, state])
|
@@ -123,6 +126,7 @@ textarea, input[type='text'] { border: 1px solid #ccc; border-radius: 20px; padd
|
|
123 |
plus.click(lambda: gr.update(visible=True), outputs=[file_input])
|
124 |
file_input.change(transcribe_audio, inputs=file_input, outputs=chat_input)
|
125 |
mic.click(start_stop_recording, inputs=recording, outputs=[chat_input, recording])
|
126 |
-
|
|
|
127 |
|
128 |
demo.launch()
|
|
|
92 |
with gr.Column(scale=1):
|
93 |
gr.Markdown("<h2 style='text-align:center;'>Chats</h2>")
|
94 |
new_chat = gr.Button("π New Chat")
|
95 |
+
chat_buttons = gr.Column()
|
96 |
|
97 |
with gr.Column(scale=3):
|
98 |
gr.Markdown("<h1 style='text-align:center;'>Neobot</h1>")
|
|
|
104 |
file_input = gr.File(file_types=[".mp3", ".wav"], visible=False)
|
105 |
|
106 |
def update_chat_list():
|
107 |
+
buttons = []
|
108 |
+
for file in list_saved_chats():
|
109 |
+
filename = file[:-5]
|
110 |
+
btn = gr.Button(filename, elem_id=f"btn_{filename}", size="sm")
|
111 |
+
btn.click(fn=lambda f=file: load_chat_file(f), inputs=[], outputs=[chatbot, state])
|
112 |
+
buttons.append(btn)
|
113 |
+
return buttons
|
114 |
|
115 |
send = gr.Button("Send π")
|
116 |
send.click(chat_with_groq, inputs=[chat_input, state], outputs=[chat_input, chatbot, state])
|
|
|
126 |
plus.click(lambda: gr.update(visible=True), outputs=[file_input])
|
127 |
file_input.change(transcribe_audio, inputs=file_input, outputs=chat_input)
|
128 |
mic.click(start_stop_recording, inputs=recording, outputs=[chat_input, recording])
|
129 |
+
|
130 |
+
demo.load(update_chat_list, outputs=[])
|
131 |
|
132 |
demo.launch()
|