diff --git "a/app.py" "b/app.py"
--- "a/app.py"
+++ "b/app.py"
@@ -43,7 +43,7 @@ from langchain.chains.question_answering import load_qa_chain
news_api_key = os.environ["NEWS_API_KEY"]
tmdb_bearer_token = os.environ["TMDB_BEARER_TOKEN"]
-TOOLS_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects']
+TOOLS_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects']
# TOOLS_DEFAULT_LIST = ['serpapi', 'pal-math']
TOOLS_DEFAULT_LIST = []
BUG_FOUND_MSG = "Congratulations, you've found a bug in this application!"
@@ -76,7 +76,6 @@ AZURE_VOICE_DATA = AzureVoiceData()
# Pertains to WHISPER functionality
WHISPER_DETECT_LANG = "Detect language"
-
# UNCOMMENT TO USE WHISPER
warnings.filterwarnings("ignore")
WHISPER_MODEL = whisper.load_model("tiny")
@@ -250,7 +249,8 @@ def load_chain(tools_list, llm):
if llm:
print("\ntools_list", tools_list)
tool_names = tools_list
- tools = load_tools(tool_names, llm=llm, news_api_key=news_api_key, tmdb_bearer_token=tmdb_bearer_token, serpapi_api_key=os.environ["SERP_API_KEY"])
+ tools = load_tools(tool_names, llm=llm, news_api_key=news_api_key, tmdb_bearer_token=tmdb_bearer_token,
+ serpapi_api_key=os.environ["SERP_API_KEY"])
memory = ConversationBufferMemory(memory_key="chat_history")
@@ -410,7 +410,7 @@ class ChatWrapper:
history.append((inp, text_to_display))
html_video, temp_file, html_audio, temp_aud_file = None, None, None, None
-
+
if speak_text:
if talking_head:
if len(output) <= MAX_TALKING_HEAD_TEXT_LENGTH:
@@ -567,6 +567,7 @@ def update_use_embeddings(widget, state):
state = widget
return state
+
with gr.Blocks(css="css/custom_css.css", title="Expert Answer Demo") as block:
llm_state = gr.State()
history_state = gr.State()
@@ -604,9 +605,9 @@ with gr.Blocks(css="css/custom_css.css", title="Expert Answer Demo") as block:
use_embeddings_state = gr.State(False)
gr.HTML("""
-

""")
- #
""")
-
+ 
""")
+
+
with gr.Tab("Chat"):
with gr.Row():
openai_api_key_textbox = gr.Textbox(placeholder="Paste your OpenAI API key (sk-...)",
@@ -629,7 +630,7 @@ with gr.Blocks(css="css/custom_css.css", title="Expert Answer Demo") as block:
tmp_aud_file_url = "/file=" + tmp_aud_file.value['name']
htm_audio = f''
audio_html = gr.HTML(htm_audio)
-
+
with gr.Column(scale=7):
chatbot = gr.Chatbot(elem_id="gr-component")
@@ -665,7 +666,8 @@ with gr.Blocks(css="css/custom_css.css", title="Expert Answer Demo") as block:
# outputs=[monologue_state])
reset_btn = gr.Button(value="Reset chat", variant="secondary").style(full_width=False)
- reset_btn.click(reset_memory, inputs=[history_state, memory_state], outputs=[chatbot, history_state, memory_state])
+ reset_btn.click(reset_memory, inputs=[history_state, memory_state],
+ outputs=[chatbot, history_state, memory_state])
message.submit(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
speak_text_state, talking_head_state, monologue_state,
@@ -675,7 +677,7 @@ with gr.Blocks(css="css/custom_css.css", title="Expert Answer Demo") as block:
lang_level_state, translate_to_state, literary_style_state,
qa_chain_state, docsearch_state, use_embeddings_state],
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
- # outputs=[chatbot, history_state, message])
+ # outputs=[chatbot, history_state, message])
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
submit.click(chat, inputs=[openai_api_key_textbox, message, history_state, chain_state, trace_chain_state,
@@ -686,7 +688,7 @@ with gr.Blocks(css="css/custom_css.css", title="Expert Answer Demo") as block:
lang_level_state, translate_to_state, literary_style_state,
qa_chain_state, docsearch_state, use_embeddings_state],
outputs=[chatbot, history_state, video_html, my_file, audio_html, tmp_aud_file, message])
- # outputs=[chatbot, history_state, message])
+ # outputs=[chatbot, history_state, message])
# outputs=[chatbot, history_state, audio_html, tmp_aud_file, message])
openai_api_key_textbox.change(set_openai_api_key,
@@ -694,4 +696,4 @@ with gr.Blocks(css="css/custom_css.css", title="Expert Answer Demo") as block:
outputs=[chain_state, express_chain_state, llm_state, embeddings_state,
qa_chain_state, memory_state])
-block.launch(debug=True)
+block.launch(debug=True)
\ No newline at end of file