Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -37,6 +37,13 @@ def bot(history):
|
|
| 37 |
yield history
|
| 38 |
|
| 39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 40 |
with gr.Blocks() as chat:
|
| 41 |
gr.Markdown(description)
|
| 42 |
|
|
@@ -53,7 +60,10 @@ with gr.Blocks() as chat:
|
|
| 53 |
bot, chatbot, chatbot
|
| 54 |
)
|
| 55 |
txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
|
| 56 |
-
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
demo = gr.TabbedInterface([auth, chat], ["Authentication Station", "Music Room"],
|
| 59 |
theme="finlaymacklon/boxy_violet",
|
|
@@ -61,6 +71,6 @@ demo = gr.TabbedInterface([auth, chat], ["Authentication Station", "Music Room"]
|
|
| 61 |
)
|
| 62 |
|
| 63 |
|
| 64 |
-
demo.queue()
|
| 65 |
demo.launch()
|
| 66 |
os.remove(".cache")
|
|
|
|
| 37 |
yield history
|
| 38 |
|
| 39 |
|
| 40 |
+
def end_session():
|
| 41 |
+
global_vars['OPENAI_API_KEY'] = None
|
| 42 |
+
sp = None
|
| 43 |
+
device_id = None
|
| 44 |
+
return f"Session Ended. Thank you for testing Apollo!\n\nPlease re-authenticate your credentials to it again."
|
| 45 |
+
|
| 46 |
+
|
| 47 |
with gr.Blocks() as chat:
|
| 48 |
gr.Markdown(description)
|
| 49 |
|
|
|
|
| 60 |
bot, chatbot, chatbot
|
| 61 |
)
|
| 62 |
txt_msg.then(lambda: gr.update(interactive=True), None, [txt], queue=False)
|
| 63 |
+
|
| 64 |
+
logout_button = gr.Button("End Your Session")
|
| 65 |
+
logout_result = gr.Markdown()
|
| 66 |
+
logout_button.click(fn=end_session, outputs=logout_result)
|
| 67 |
|
| 68 |
demo = gr.TabbedInterface([auth, chat], ["Authentication Station", "Music Room"],
|
| 69 |
theme="finlaymacklon/boxy_violet",
|
|
|
|
| 71 |
)
|
| 72 |
|
| 73 |
|
| 74 |
+
demo.queue(max_size=1)
|
| 75 |
demo.launch()
|
| 76 |
os.remove(".cache")
|