bstraehle commited on
Commit
4d08f8e
·
verified ·
1 Parent(s): 370ab70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -3
app.py CHANGED
@@ -53,6 +53,8 @@ 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
  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")
@@ -65,9 +67,6 @@ def ask(question, openai_api_key, gemini_api_key, anthropic_api_key, file_name =
65
  except Exception as e:
66
  gr.Warning(str(e))
67
  return ""
68
- #finally:
69
- # for key in ["OPENAI_API_KEY", "GEMINI_API_KEY", "MODEL_API_KEY"]:
70
- # os.environ.pop(key, None)
71
 
72
  # Helper functions
73
 
 
53
  file_name = f"files/{file_name}"
54
 
55
  try:
56
+ # API keys are provided thanks to sponsor credit.
57
+
58
  openai_key = openai_api_key if openai_api_key and openai_api_key != "*" else os.environ.get("OPENAI_API_KEY")
59
  gemini_key = gemini_api_key if gemini_api_key and gemini_api_key != "*" else os.environ.get("GEMINI_API_KEY")
60
  anthropic_key = anthropic_api_key if anthropic_api_key and anthropic_api_key != "*" else os.environ.get("ANTHROPIC_API_KEY")
 
67
  except Exception as e:
68
  gr.Warning(str(e))
69
  return ""
 
 
 
70
 
71
  # Helper functions
72