Update app.py
Browse files
app.py
CHANGED
|
@@ -53,10 +53,14 @@ def ask(question, openai_api_key, gemini_api_key, anthropic_api_key, file_name =
|
|
| 53 |
file_name = f"files/{file_name}"
|
| 54 |
|
| 55 |
try:
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 60 |
return run_crew(question, file_name)
|
| 61 |
except Exception as e:
|
| 62 |
gr.Warning(str(e))
|
|
|
|
| 53 |
file_name = f"files/{file_name}"
|
| 54 |
|
| 55 |
try:
|
| 56 |
+
openai_key = openai_api_key if openai_api_key and openai_api_key != "*" else os.environ.get("OPENAI_API_KEY")
|
| 57 |
+
gemini_key = gemini_api_key if gemini_api_key and gemini_api_key != "*" else os.environ.get("GEMINI_API_KEY")
|
| 58 |
+
anthropic_key = anthropic_api_key if anthropic_api_key and anthropic_api_key != "*" else os.environ.get("ANTHROPIC_API_KEY")
|
| 59 |
|
| 60 |
+
os.environ["OPENAI_API_KEY"] = openai_key
|
| 61 |
+
os.environ["GEMINI_API_KEY"] = gemini_key
|
| 62 |
+
os.environ["ANTHROPIC_API_KEY"] = anthropic_key
|
| 63 |
+
|
| 64 |
return run_crew(question, file_name)
|
| 65 |
except Exception as e:
|
| 66 |
gr.Warning(str(e))
|