Spaces:
Running
Running
Commit
ยท
9c87482
1
Parent(s):
65028bf
Upload 12 files
Browse files
app.py
CHANGED
@@ -45,14 +45,9 @@ from langchain.docstore.document import Document
|
|
45 |
from langchain.chains.question_answering import load_qa_chain
|
46 |
|
47 |
|
48 |
-
news_api_key
|
49 |
-
|
50 |
-
# tmdb_bearer_token = os.environ["TMDB_BEARER_TOKEN"]
|
51 |
-
tmdb_bearer_token = "ef6345567bb53731af1fd359c5ed5ec9"
|
52 |
-
wolfram_alpha_appid = "7GGGXQ-JU528AAU49"
|
53 |
-
serpapi_api_key = "acdf702b5d1b23c394024e14901dccec4d0f4460d377d2667f55bef51d1470b5"
|
54 |
|
55 |
-
openai_api_key = "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"
|
56 |
|
57 |
TOOLS_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects', 'news-api'] #'google-search','news-api','tmdb-api','open-meteo-api'
|
58 |
TOOLS_DEFAULT_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects', 'news-api']
|
@@ -315,7 +310,6 @@ def set_openai_api_key(api_key):
|
|
315 |
return None, None, None, None, None, None
|
316 |
|
317 |
# PROMPTLAYER_API_BASE = "https://api.promptlayer.com"
|
318 |
-
# chain, express_chain, llm, embeddings, qa_chain, memory, use_gpt4 = set_openai_api_key(openai_api_key)
|
319 |
|
320 |
def run_chain(chain, inp, capture_hidden_text):
|
321 |
output = ""
|
@@ -603,24 +597,17 @@ def update_use_embeddings(widget, state):
|
|
603 |
|
604 |
|
605 |
with gr.Blocks(css=".gradio-container {background-color: lightgray}") as block:
|
606 |
-
# llm_state = gr.State()
|
607 |
llm_state = gr.State()
|
608 |
-
|
609 |
history_state = gr.State()
|
610 |
-
# chain_state = gr.State()
|
611 |
-
# express_chain_state = gr.State()
|
612 |
chain_state = gr.State()
|
613 |
express_chain_state = gr.State()
|
614 |
-
|
615 |
tools_list_state = gr.State(TOOLS_DEFAULT_LIST)
|
616 |
trace_chain_state = gr.State(False)
|
617 |
speak_text_state = gr.State(False)
|
618 |
talking_head_state = gr.State(True)
|
619 |
monologue_state = gr.State(False) # Takes the input and repeats it back to the user, optionally transforming it.
|
620 |
-
# memory_state = gr.State()
|
621 |
memory_state = gr.State()
|
622 |
|
623 |
-
|
624 |
# Pertains to Express-inator functionality
|
625 |
num_words_state = gr.State(NUM_WORDS_DEFAULT)
|
626 |
formality_state = gr.State(FORMALITY_DEFAULT)
|
@@ -654,7 +641,7 @@ with gr.Blocks(css=".gradio-container {background-color: lightgray}") as block:
|
|
654 |
</b></center></p>""")
|
655 |
|
656 |
openai_api_key_textbox = gr.Textbox(placeholder="sk-... ์์ํ๋ OpenAI API key ๋ถ์ฌ๋ฃ๊ธฐ",
|
657 |
-
show_label=False, lines=1, type='password'
|
658 |
# openai_api_key_textbox = gr.Textbox(placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
659 |
# show_label=False, lines=1, type='password')
|
660 |
|
|
|
45 |
from langchain.chains.question_answering import load_qa_chain
|
46 |
|
47 |
|
48 |
+
news_api_key = os.environ["NEWS_API_KEY"]
|
49 |
+
tmdb_bearer_token = os.environ["TMDB_BEARER_TOKEN"]
|
|
|
|
|
|
|
|
|
50 |
|
|
|
51 |
|
52 |
TOOLS_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects', 'news-api'] #'google-search','news-api','tmdb-api','open-meteo-api'
|
53 |
TOOLS_DEFAULT_LIST = ['serpapi', 'wolfram-alpha', 'pal-math', 'pal-colored-objects', 'news-api']
|
|
|
310 |
return None, None, None, None, None, None
|
311 |
|
312 |
# PROMPTLAYER_API_BASE = "https://api.promptlayer.com"
|
|
|
313 |
|
314 |
def run_chain(chain, inp, capture_hidden_text):
|
315 |
output = ""
|
|
|
597 |
|
598 |
|
599 |
with gr.Blocks(css=".gradio-container {background-color: lightgray}") as block:
|
|
|
600 |
llm_state = gr.State()
|
|
|
601 |
history_state = gr.State()
|
|
|
|
|
602 |
chain_state = gr.State()
|
603 |
express_chain_state = gr.State()
|
|
|
604 |
tools_list_state = gr.State(TOOLS_DEFAULT_LIST)
|
605 |
trace_chain_state = gr.State(False)
|
606 |
speak_text_state = gr.State(False)
|
607 |
talking_head_state = gr.State(True)
|
608 |
monologue_state = gr.State(False) # Takes the input and repeats it back to the user, optionally transforming it.
|
|
|
609 |
memory_state = gr.State()
|
610 |
|
|
|
611 |
# Pertains to Express-inator functionality
|
612 |
num_words_state = gr.State(NUM_WORDS_DEFAULT)
|
613 |
formality_state = gr.State(FORMALITY_DEFAULT)
|
|
|
641 |
</b></center></p>""")
|
642 |
|
643 |
openai_api_key_textbox = gr.Textbox(placeholder="sk-... ์์ํ๋ OpenAI API key ๋ถ์ฌ๋ฃ๊ธฐ",
|
644 |
+
show_label=False, lines=1, type='password')
|
645 |
# openai_api_key_textbox = gr.Textbox(placeholder="Paste your OpenAI API key (sk-...) and hit Enter",
|
646 |
# show_label=False, lines=1, type='password')
|
647 |
|