Spaces:
Sleeping
Sleeping
Update app.py
Browse files38 unmodified lines3940414243444598 unmodified lines1441451461471481491501 unmodified line1521531541551561571583 unmodified lines16216316416516616716827 unmodified lines1961971981992002012022032042052062072082092102112122132144 unmodified lines21922022122222322422522622722822923023123223323438 unmodified linesideology_test,political_statement,temperature,top_p,num_contexts):98 unmodified linesreturn 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 linewith gr.Row():ideology_test = gr.Dropdown(scale=1,label="Ideology Test",choices=["Wahl-O-Mat", "Political Compass Test"],value="Wahl-O-Mat", # Default valuefilterable=False3 unmodified linespolitical_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",value="1. Auf allen Autobahnen soll ein generelles Tempolimit gelten.", # default valuechoices=political_statement_initial_choices, # Set default to 'Wahl-O-Mat' statementsallow_custom_value = True27 unmodified lineswith gr.Row():model_selector1 = gr.Dropdown(label="Model 1", choices=supported_models)model_selector2 = gr.Dropdown(label="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")# Place this at the end of the App tab setupwith gr.Row():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 lineswith 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 functionsubmit_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],outputs=[output1, output2, prompt_display])38 unmodified lines39404142434498 unmodified lines1431441451461471481491 unmodified line1511521531541551561573 unmodified lines16116216316416516616727 unmodified lines1951961971981992002012022032042052062072082092102112122134 unmodified lines21821922022122222322422522622722822923038 unmodified linesideology_test,political_statement,temperature,num_contexts):98 unmodified linesreturn gr.Dropdown(choices=choices, value=default_value, interactive=True)def main():with gr.Blocks(theme=gr.themes.Base()) as demo:# Ideology Test drowndown1 unmodified linewith gr.Row():ideology_test = gr.Dropdown(scale=1,label="Ideology test",choices=["Wahl-O-Mat", "Political Compass Test"],value="Wahl-O-Mat", # Default valuefilterable=False3 unmodified linespolitical_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 your own",value="1. Auf allen Autobahnen soll ein generelles Tempolimit gelten.", # default valuechoices=political_statement_initial_choices, # Set default to 'Wahl-O-Mat' statementsallow_custom_value = True27 unmodified lineswith gr.Row():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")# Place this at the end of the App tab setupwith gr.Row():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 lineswith gr.Row():temp_input = gr.Slider(minimum=0, maximum=2, step=0.01, label="Temperature", value=0.7)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 functionsubmit_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, num_contexts],outputs=[output1, output2, prompt_display])
app.py+9-13