Spaces:
Sleeping
Sleeping
Update app.py
Browse files38 unmodified lines3940414242434498 unmodified lines1431441451471461471481491 unmodified line1511521531551541551561573 unmodified lines16116216316516416516616727 unmodified lines1951961971992001981992002012022032052062042052062072082092112102112122134 unmodified lines21821922022222322422122222322422522623122722822923038 unmodified lines ideology_test, political_statement, temperature, top_p, num_contexts ): 98 unmodified lines return gr.Dropdown(choices=choices, value=default_value, interactive=True)
def main(): description = "This is a simple interface to compare two model prodided by Anyscale. Please enter your API key and your message."
with gr.Blocks(theme=gr.themes.Base()) as demo:
# Ideology Test drowndown1 unmodified line with gr.Row(): ideology_test = gr.Dropdown( scale=1, label="Ideology Test", label="Ideology test", choices=["Wahl-O-Mat", "Political Compass Test"], value="Wahl-O-Mat", # Default value filterable=False3 unmodified lines political_statement_initial_choices = [f"{i+1}. {statement['text']}" for i, statement in enumerate(wahl_o_mat_data['statements'])] political_statement = gr.Dropdown( scale=2, label="Select political statement or enter you own", label="Select political statement or enter your own", value="1. Auf allen Autobahnen soll ein generelles Tempolimit gelten.", # default value choices=political_statement_initial_choices, # Set default to 'Wahl-O-Mat' statements allow_custom_value = True27 unmodified lines with gr.Row(): model_selector1 = gr.Dropdown(label="Model 1", choices=supported_models) model_selector2 = gr.Dropdown(label="Model 2", choices=supported_models) model_selector1 = gr.Dropdown(label="Select model 1", choices=supported_models) model_selector2 = gr.Dropdown(label="Select model 2", choices=supported_models) submit_btn = gr.Button("Submit") with gr.Row(): output1 = gr.Textbox(label="Model 1 Response") output2 = gr.Textbox(label="Model 2 Response") output1 = gr.Textbox(label="Model 1 response") output2 = gr.Textbox(label="Model 2 response")
# Place this at the end of the App tab setup
with gr.Row(): with gr.Accordion("Prompt Details", open=False): with gr.Accordion("Prompt details", open=False): prompt_display = gr.Textbox(show_label=False, interactive=False, placeholder="Prompt used in the last query will appear here.")
with gr.Tab("Settings"):4 unmodified lines with gr.Row(): temp_input = gr.Slider(minimum=0, maximum=2, step=0.01, label="Temperature", value=0.7) with gr.Row(): top_p_input = gr.Slider(minimum=0, maximum=1, step=0.01, label="Top P", value=1) with gr.Row(): num_contexts = gr.Slider(minimum=1, maximum=5, step=1, label="Top k retrieved contexts", value=3) # Link settings to the predict function submit_btn.click( fn=predict, inputs=[openai_api_key, togetherai_api_key, model_selector1, model_selector2, prompt_manipulation, direct_steering_option, ideology_test, political_statement, temp_input, top_p_input, num_contexts], inputs=[openai_api_key, togetherai_api_key, model_selector1, model_selector2, prompt_manipulation, direct_steering_option, ideology_test, political_statement, temp_input, num_contexts], outputs=[output1, output2, prompt_display] )
app.py+9-13