update fix
Browse files65 unmodified lines666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381392 unmodified lines14214314414565 unmodified lines"Perplexity": demo_perplexity,}# Create code snippets for each providerdef get_code_snippet(provider):if "OpenAI" in provider:return """import gradio as grimport ai_gradiogr.load(name='openai:gpt-4-turbo',src=ai_gradio.registry,title='AI Chat',description='Chat with an AI model').launch()"""elif "Gemini" in provider:return """import gradio as grimport ai_gradiogr.load(name='gemini:gemini-1.5-flash',src=ai_gradio.registry,title='AI Chat',description='Chat with an AI model').launch()"""elif "Groq" in provider:return """import gradio as grimport ai_gradiogr.load(name='groq:llama-3.2-70b-chat',src=ai_gradio.registry,title='AI Chat',description='Chat with an AI model').launch()"""return ""import gradio as gr# Modified get_app to include code snippetsdef get_app(models, default_model, src, dropdown_label):with gr.Blocks() as demo:# Add code snippet displaycode_component = gr.Code(label="Code Snippet",language="python",value=get_code_snippet(default_model))# Add dropdown and get the demo interfacemodel = gr.Dropdown(choices=models,value=default_model,label=dropdown_label)# Update code snippet when model changesdef update_code(provider):return get_code_snippet(provider)model.change(fn=update_code,inputs=[model],outputs=[code_component])# Get the demo interface for the selected modeldemo_interface = src[default_model]()return demodemo = get_app(models=list(PROVIDERS.keys()),default_model="OpenAI Coder",2 unmodified lines)if __name__ == "__main__":demo.queue(api_open=False).launch(show_api=False)65 unmodified lines6667686970712 unmodified lines7475767765 unmodified lines"Perplexity": demo_perplexity,}demo = get_app(models=list(PROVIDERS.keys()),default_model="OpenAI Coder",2 unmodified lines)if __name__ == "__main__":demo.queue(api_open=False).launch(show_api=False)
app.py+1-69