Ouz commited on
Commit
aba4c86
·
1 Parent(s): 24dc9b8

pop-up for missing api keys

Browse files
Files changed (1) hide show
  1. app.py +7 -2
app.py CHANGED
@@ -32,6 +32,11 @@ def initialize_client(api_key):
32
 
33
  def process_and_evaluate(api_key, user_input, llm_response, selected_evaluator):
34
  global client
 
 
 
 
 
35
  if not client:
36
  evaluator_dropdown = initialize_client(api_key)
37
 
@@ -98,7 +103,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
98
  api_key.change(
99
  fn=initialize_client,
100
  inputs=[api_key],
101
- outputs=[] # Remove evaluator_dropdown from outputs
102
  )
103
 
104
  # Button to trigger the process
@@ -109,7 +114,7 @@ with gr.Blocks(theme=gr.themes.Default(primary_hue="blue")) as demo:
109
  outputs=[score, justification]
110
  )
111
 
112
- gr.Markdown("[Homepage](https://www.rootsignals.ai/) | [Python SDK Docs](https://sdk.rootsignals.ai/en/latest/)")
113
 
114
  if __name__ == "__main__":
115
  demo.launch()
 
32
 
33
  def process_and_evaluate(api_key, user_input, llm_response, selected_evaluator):
34
  global client
35
+ if not api_key:
36
+ # Display a pop-up info message
37
+ gr.Info("API key is missing. Please enter your API key to proceed.")
38
+ return "", ""
39
+
40
  if not client:
41
  evaluator_dropdown = initialize_client(api_key)
42
 
 
103
  api_key.change(
104
  fn=initialize_client,
105
  inputs=[api_key],
106
+ outputs=[]
107
  )
108
 
109
  # Button to trigger the process
 
114
  outputs=[score, justification]
115
  )
116
 
117
+ gr.Markdown("[🌐 Homepage](https://www.rootsignals.ai/) | [🤖 Github Repo](https://sdk.rootsignals.ai/en/latest/) | [🐍 Python SDK Docs](https://sdk.rootsignals.ai/en/latest/) | [💬 Discord](https://discord.gg/EhazTQsFnj)")
118
 
119
  if __name__ == "__main__":
120
  demo.launch()