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)