bstraehle commited on
Commit
cc2d7ff
·
verified ·
1 Parent(s): e35f60f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -18,16 +18,16 @@ def ask(question, openai_api_key, gemini_api_key, anthropic_api_key, file_name =
18
  str: The answer to the question
19
  """
20
  if not question:
21
- raise gr.Error("Question is required.")
22
 
23
  if not openai_api_key:
24
- raise gr.Error("OpenAI API Key is required.")
25
 
26
  if not gemini_api_key:
27
- raise gr.Error("Gemini API Key is required.")
28
 
29
  if not anthropic_api_key:
30
- raise gr.Error("Anthropic API Key is required.")
31
 
32
  if file_name:
33
  file_name = f"data/{file_name}"
@@ -44,7 +44,7 @@ def ask(question, openai_api_key, gemini_api_key, anthropic_api_key, file_name =
44
 
45
  answer = run_crew(question, file_name)
46
  except Exception as e:
47
- raise gr.Error(e)
48
  finally:
49
  del os.environ["OPENAI_API_KEY"]
50
  del os.environ["GEMINI_API_KEY"]
 
18
  str: The answer to the question
19
  """
20
  if not question:
21
+ raise gr.Warning("Question is required.")
22
 
23
  if not openai_api_key:
24
+ raise gr.Warning("OpenAI API Key is required.")
25
 
26
  if not gemini_api_key:
27
+ raise gr.Warning("Gemini API Key is required.")
28
 
29
  if not anthropic_api_key:
30
+ raise gr.Warning("Anthropic API Key is required.")
31
 
32
  if file_name:
33
  file_name = f"data/{file_name}"
 
44
 
45
  answer = run_crew(question, file_name)
46
  except Exception as e:
47
+ raise gr.Warning(e)
48
  finally:
49
  del os.environ["OPENAI_API_KEY"]
50
  del os.environ["GEMINI_API_KEY"]