From ca7044bc90689cac1b577025c687e18b3428df57 Mon Sep 17 00:00:00 2001 From: Cyberes Date: Wed, 11 Oct 2023 18:49:31 -0600 Subject: [PATCH] update gradio chat --- other/gradio/gradio_chat.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/other/gradio/gradio_chat.py b/other/gradio/gradio_chat.py index ee3d3ab..179e748 100644 --- a/other/gradio/gradio_chat.py +++ b/other/gradio/gradio_chat.py @@ -19,6 +19,7 @@ API_BASE = API_BASE.strip('/') APP_TITLE = os.getenv('APP_TITLE') PRIMARY_MODEL_CHOICE = os.getenv('PRIMARY_MODEL_CHOICE') +TRACKING_CODE = os.getenv('TRACKING_CODE') def background(): @@ -92,4 +93,11 @@ examples = ["hello"] if CONTEXT_TRIGGER_PHRASE: examples.insert(0, CONTEXT_TRIGGER_PHRASE) -gr.ChatInterface(stream_response, examples=examples, title=APP_TITLE, analytics_enabled=False, cache_examples=False, css='#component-0{height:100%!important}').queue(concurrency_count=1, api_open=False).launch(show_api=False) +with gr.Blocks(analytics_enabled=False) as demo: + gr.ChatInterface(stream_response, examples=examples, title=APP_TITLE, analytics_enabled=False, cache_examples=False, css='#component-0{height:100%!important}') + + if TRACKING_CODE: + print('Inserting tracking code') + gr.HTML(TRACKING_CODE) + +demo.queue(concurrency_count=1, api_open=False).launch(show_api=False)