Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -39,7 +39,6 @@ def predict(
|
|
39 |
ideology_test,
|
40 |
political_statement,
|
41 |
temperature,
|
42 |
-
top_p,
|
43 |
num_contexts
|
44 |
):
|
45 |
|
@@ -144,7 +143,7 @@ def update_direct_steering_options(prompt_type):
|
|
144 |
return gr.Dropdown(choices=choices, value=default_value, interactive=True)
|
145 |
|
146 |
def main():
|
147 |
-
|
148 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
149 |
|
150 |
# Ideology Test drowndown
|
@@ -152,7 +151,7 @@ def main():
|
|
152 |
with gr.Row():
|
153 |
ideology_test = gr.Dropdown(
|
154 |
scale=1,
|
155 |
-
label="Ideology
|
156 |
choices=["Wahl-O-Mat", "Political Compass Test"],
|
157 |
value="Wahl-O-Mat", # Default value
|
158 |
filterable=False
|
@@ -162,7 +161,7 @@ def main():
|
|
162 |
political_statement_initial_choices = [f"{i+1}. {statement['text']}" for i, statement in enumerate(wahl_o_mat_data['statements'])]
|
163 |
political_statement = gr.Dropdown(
|
164 |
scale=2,
|
165 |
-
label="Select political statement or enter
|
166 |
value="1. Auf allen Autobahnen soll ein generelles Tempolimit gelten.", # default value
|
167 |
choices=political_statement_initial_choices, # Set default to 'Wahl-O-Mat' statements
|
168 |
allow_custom_value = True
|
@@ -196,19 +195,19 @@ def main():
|
|
196 |
|
197 |
|
198 |
with gr.Row():
|
199 |
-
model_selector1 = gr.Dropdown(label="
|
200 |
-
model_selector2 = gr.Dropdown(label="
|
201 |
submit_btn = gr.Button("Submit")
|
202 |
|
203 |
|
204 |
with gr.Row():
|
205 |
-
output1 = gr.Textbox(label="Model 1
|
206 |
-
output2 = gr.Textbox(label="Model 2
|
207 |
|
208 |
# Place this at the end of the App tab setup
|
209 |
|
210 |
with gr.Row():
|
211 |
-
with gr.Accordion("Prompt
|
212 |
prompt_display = gr.Textbox(show_label=False, interactive=False, placeholder="Prompt used in the last query will appear here.")
|
213 |
|
214 |
with gr.Tab("Settings"):
|
@@ -219,16 +218,13 @@ def main():
|
|
219 |
with gr.Row():
|
220 |
temp_input = gr.Slider(minimum=0, maximum=2, step=0.01, label="Temperature", value=0.7)
|
221 |
|
222 |
-
with gr.Row():
|
223 |
-
top_p_input = gr.Slider(minimum=0, maximum=1, step=0.01, label="Top P", value=1)
|
224 |
-
|
225 |
with gr.Row():
|
226 |
num_contexts = gr.Slider(minimum=1, maximum=5, step=1, label="Top k retrieved contexts", value=3)
|
227 |
|
228 |
# Link settings to the predict function
|
229 |
submit_btn.click(
|
230 |
fn=predict,
|
231 |
-
inputs=[openai_api_key, togetherai_api_key, model_selector1, model_selector2, prompt_manipulation, direct_steering_option, ideology_test, political_statement, temp_input,
|
232 |
outputs=[output1, output2, prompt_display]
|
233 |
)
|
234 |
|
|
|
39 |
ideology_test,
|
40 |
political_statement,
|
41 |
temperature,
|
|
|
42 |
num_contexts
|
43 |
):
|
44 |
|
|
|
143 |
return gr.Dropdown(choices=choices, value=default_value, interactive=True)
|
144 |
|
145 |
def main():
|
146 |
+
|
147 |
with gr.Blocks(theme=gr.themes.Base()) as demo:
|
148 |
|
149 |
# Ideology Test drowndown
|
|
|
151 |
with gr.Row():
|
152 |
ideology_test = gr.Dropdown(
|
153 |
scale=1,
|
154 |
+
label="Ideology test",
|
155 |
choices=["Wahl-O-Mat", "Political Compass Test"],
|
156 |
value="Wahl-O-Mat", # Default value
|
157 |
filterable=False
|
|
|
161 |
political_statement_initial_choices = [f"{i+1}. {statement['text']}" for i, statement in enumerate(wahl_o_mat_data['statements'])]
|
162 |
political_statement = gr.Dropdown(
|
163 |
scale=2,
|
164 |
+
label="Select political statement or enter your own",
|
165 |
value="1. Auf allen Autobahnen soll ein generelles Tempolimit gelten.", # default value
|
166 |
choices=political_statement_initial_choices, # Set default to 'Wahl-O-Mat' statements
|
167 |
allow_custom_value = True
|
|
|
195 |
|
196 |
|
197 |
with gr.Row():
|
198 |
+
model_selector1 = gr.Dropdown(label="Select model 1", choices=supported_models)
|
199 |
+
model_selector2 = gr.Dropdown(label="Select model 2", choices=supported_models)
|
200 |
submit_btn = gr.Button("Submit")
|
201 |
|
202 |
|
203 |
with gr.Row():
|
204 |
+
output1 = gr.Textbox(label="Model 1 response")
|
205 |
+
output2 = gr.Textbox(label="Model 2 response")
|
206 |
|
207 |
# Place this at the end of the App tab setup
|
208 |
|
209 |
with gr.Row():
|
210 |
+
with gr.Accordion("Prompt details", open=False):
|
211 |
prompt_display = gr.Textbox(show_label=False, interactive=False, placeholder="Prompt used in the last query will appear here.")
|
212 |
|
213 |
with gr.Tab("Settings"):
|
|
|
218 |
with gr.Row():
|
219 |
temp_input = gr.Slider(minimum=0, maximum=2, step=0.01, label="Temperature", value=0.7)
|
220 |
|
|
|
|
|
|
|
221 |
with gr.Row():
|
222 |
num_contexts = gr.Slider(minimum=1, maximum=5, step=1, label="Top k retrieved contexts", value=3)
|
223 |
|
224 |
# Link settings to the predict function
|
225 |
submit_btn.click(
|
226 |
fn=predict,
|
227 |
+
inputs=[openai_api_key, togetherai_api_key, model_selector1, model_selector2, prompt_manipulation, direct_steering_option, ideology_test, political_statement, temp_input, num_contexts],
|
228 |
outputs=[output1, output2, prompt_display]
|
229 |
)
|
230 |
|