Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -25,15 +25,11 @@ from assistants import (
|
|
| 25 |
extract_content_values,
|
| 26 |
)
|
| 27 |
|
| 28 |
-
def chat(message, history
|
| 29 |
if not message:
|
| 30 |
raise gr.Error("Message is required.")
|
| 31 |
|
| 32 |
-
|
| 33 |
-
raise gr.Error("OpenAI API key is required.")
|
| 34 |
-
|
| 35 |
-
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 36 |
-
os.environ["TAVILY_API_KEY"] = tavily_api_key
|
| 37 |
|
| 38 |
global assistant, thread
|
| 39 |
|
|
@@ -62,9 +58,6 @@ def chat(message, history, openai_api_key, tavily_api_key):
|
|
| 62 |
if len(image_values) > 0:
|
| 63 |
download_link = f"<hr>[Download](https://platform.openai.com/storage/files/{image_values[0]})"
|
| 64 |
|
| 65 |
-
del os.environ["OPENAI_API_KEY"]
|
| 66 |
-
del os.environ["TAVILY_API_KEY"]
|
| 67 |
-
|
| 68 |
#return f"{'<hr>'.join(list(reversed(text_values))[1:])}{download_link}"
|
| 69 |
return f"{text_values[0]}{download_link}"
|
| 70 |
|
|
@@ -87,8 +80,4 @@ gr.ChatInterface(
|
|
| 87 |
["1. Execute with tools: Get key announcements from latest OpenAI Dev Day. 2. Show the web references.", "TODO"]
|
| 88 |
],
|
| 89 |
cache_examples=False,
|
| 90 |
-
additional_inputs=[
|
| 91 |
-
gr.Textbox(label="OpenAI API Key", type="password"),
|
| 92 |
-
gr.Textbox(label="Tavily API Key", type="password"),
|
| 93 |
-
],
|
| 94 |
).launch()
|
|
|
|
| 25 |
extract_content_values,
|
| 26 |
)
|
| 27 |
|
| 28 |
+
def chat(message, history):
|
| 29 |
if not message:
|
| 30 |
raise gr.Error("Message is required.")
|
| 31 |
|
| 32 |
+
#raise gr.Error("Please clone and bring your own credentials.")
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
|
| 34 |
global assistant, thread
|
| 35 |
|
|
|
|
| 58 |
if len(image_values) > 0:
|
| 59 |
download_link = f"<hr>[Download](https://platform.openai.com/storage/files/{image_values[0]})"
|
| 60 |
|
|
|
|
|
|
|
|
|
|
| 61 |
#return f"{'<hr>'.join(list(reversed(text_values))[1:])}{download_link}"
|
| 62 |
return f"{text_values[0]}{download_link}"
|
| 63 |
|
|
|
|
| 80 |
["1. Execute with tools: Get key announcements from latest OpenAI Dev Day. 2. Show the web references.", "TODO"]
|
| 81 |
],
|
| 82 |
cache_examples=False,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
).launch()
|