import gradio as gr models=[ "runwayml/stable-diffusion-v1-5", "claudfuen/photorealistic-fuen-v1", "nitrosocke/redshift-diffusion", ] model_box=[ gr.Interface.load(f"models/{models[0]}",live=True,preprocess=True), gr.Interface.load(f"models/{models[1]}",live=True,preprocess=True), gr.Interface.load(f"models/{models[2]}",live=True,preprocess=True), ] current_model=model_box[0] def the_process(input_text, model_choice): a_variable = model_box[model_choice] output = a_variable(input_text) return(output) with gr.Blocks() as demo: gr.HTML("""

Example Space to copy/paste

""") with gr.Row(): with gr.Column(): model_choice = gr.Dropdown(label="Select Model", choices=[m for m in models], type="index", interactive=True) input_text = gr.Textbox(label="Input Prompt") the_button = gr.Button(label="Run") with gr.Column(): output_window = gr.Image(label="Generated Image") the_button.click(the_process, inputs=[input_text, model_choice], outputs=[output_window]) demo.launch()