Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -52,18 +52,26 @@ def clear():
|
|
| 52 |
global messages
|
| 53 |
messages = [{"role": "system", "content": 'You are a helpful technology assistant.'}]
|
| 54 |
return
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
|
| 56 |
|
| 57 |
-
with gr.Blocks() as
|
| 58 |
gr.Markdown("Click the Clear button below to remove all the chat history.")
|
| 59 |
clear_btn = gr.Button("Clear")
|
| 60 |
clear_btn.click(fn=clear, inputs=None, outputs=None, queue=False)
|
| 61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
|
| 63 |
|
| 64 |
text = gr.Interface(fn=textGPT, inputs="text", outputs="text")
|
| 65 |
audio = gr.Interface(fn=audioGPT, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
|
| 66 |
-
demo = gr.TabbedInterface([text, audio,
|
| 67 |
|
| 68 |
if __name__ == "__main__":
|
| 69 |
demo.launch(enable_queue=False, auth=lambda u, p: user_db.get(u) == p,
|
|
|
|
| 52 |
global messages
|
| 53 |
messages = [{"role": "system", "content": 'You are a helpful technology assistant.'}]
|
| 54 |
return
|
| 55 |
+
|
| 56 |
+
def show():
|
| 57 |
+
global messages
|
| 58 |
+
return messages
|
| 59 |
|
| 60 |
|
| 61 |
+
with gr.Blocks() as chatHistory:
|
| 62 |
gr.Markdown("Click the Clear button below to remove all the chat history.")
|
| 63 |
clear_btn = gr.Button("Clear")
|
| 64 |
clear_btn.click(fn=clear, inputs=None, outputs=None, queue=False)
|
| 65 |
|
| 66 |
+
gr.Markdown("Click the Display button below to show all the chat history.")
|
| 67 |
+
clear_btn = gr.Button("Display")
|
| 68 |
+
clear_btn.click(fn=show, inputs=None, outputs="text", queue=False)
|
| 69 |
+
|
| 70 |
|
| 71 |
|
| 72 |
text = gr.Interface(fn=textGPT, inputs="text", outputs="text")
|
| 73 |
audio = gr.Interface(fn=audioGPT, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
|
| 74 |
+
demo = gr.TabbedInterface([text, audio, chatHistory], [ "chatGPT", "audioGPT", "ChatHistory"])
|
| 75 |
|
| 76 |
if __name__ == "__main__":
|
| 77 |
demo.launch(enable_queue=False, auth=lambda u, p: user_db.get(u) == p,
|