Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -31,9 +31,9 @@ def chat(message, history, openai_api_key, tavily_api_key):
|
|
31 |
|
32 |
if not openai_api_key:
|
33 |
raise gr.Error("OpenAI API key is required.")
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
global assistant, thread
|
39 |
|
@@ -61,6 +61,9 @@ def chat(message, history, openai_api_key, tavily_api_key):
|
|
61 |
# TODO: Handle multiple images and other file types
|
62 |
if len(image_values) > 0:
|
63 |
download_link = f"<hr>[Download](https://platform.openai.com/storage/files/{image_values[0]})"
|
|
|
|
|
|
|
64 |
|
65 |
#return f"{'<hr>'.join(list(reversed(text_values))[1:])}{download_link}"
|
66 |
return f"{text_values[0]}{download_link}"
|
|
|
31 |
|
32 |
if not openai_api_key:
|
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 |
|
|
|
61 |
# TODO: Handle multiple images and other file types
|
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}"
|