jost commited on
Commit
6f3513c
1 Parent(s): f13aa60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -32,7 +32,19 @@ def predict(api_key, user_input, model1, model2, prompt_manipulation=None, direc
32
 
33
  return response1, response2
34
 
35
-
 
 
 
 
 
 
 
 
 
 
 
 
36
  def main():
37
  description = "This is a simple interface to compare two model prodided by Anyscale. Please enter your API key and your message."
38
  with gr.Blocks() as demo:
@@ -51,20 +63,8 @@ def main():
51
 
52
  # Conditional dropdown - options revealed based on ‘Prompt Manipulation’ selection
53
  with gr.Row():
54
- direct_steering_option = gr.Dropdown(
55
- label="Direct Steering Options",
56
- choices=["Option 1", "Option 2", "Option 3", "Option 4"],
57
- visible=True # Initially hidden
58
- )
59
-
60
- # Making direct_steering_option visible based on prompt_manipulation choice
61
- def show_direct_steering_options(prompt_choice):
62
- return prompt_choice == "Impersonation (direct steering)"
63
-
64
- prompt_manipulation.change(fn=show_direct_steering_options,
65
- inputs=[prompt_manipulation],
66
- outputs=[direct_steering_option])
67
-
68
 
69
  with gr.Row():
70
  api_key_input = gr.Textbox(label="API Key", placeholder="Enter your API key here", show_label=True, type="password")
 
32
 
33
  return response1, response2
34
 
35
+ def update_dropdown_options(selected_option):
36
+ if selected_option == "Impersonation (direct steering)":
37
+ return ["Option 1", "Option 2"]
38
+
39
+ elif selected_option == "Most similar RAG (indirect steering with related context)":
40
+ return ["Option 1", "Option 2"]
41
+
42
+ elif selected_option == "Random RAG (indirect steering with randomized context)":
43
+ return ["Option 1", "Option 2"]
44
+
45
+ else:
46
+ return []
47
+
48
  def main():
49
  description = "This is a simple interface to compare two model prodided by Anyscale. Please enter your API key and your message."
50
  with gr.Blocks() as demo:
 
63
 
64
  # Conditional dropdown - options revealed based on ‘Prompt Manipulation’ selection
65
  with gr.Row():
66
+ direct_steering_option = gr.Dropdown(label="Direct Steering Option")
67
+ prompt_manipulation.change(fn=update_dropdown_options, inputs=prompt_manipulation, outputs=direct_steering_option)
 
 
 
 
 
 
 
 
 
 
 
 
68
 
69
  with gr.Row():
70
  api_key_input = gr.Textbox(label="API Key", placeholder="Enter your API key here", show_label=True, type="password")