Spaces:
Sleeping
Sleeping
import gradio as gr | |
import gemini_gradio | |
with gr.Blocks(fill_height=True) as demo: | |
gr.Markdown("**Note:** You need to use a SambaNova API key from [SambaNova Cloud](https://cloud.sambanova.ai/).") | |
with gr.Tab("Gemini"): | |
with gr.Row(): | |
gemini_model = gr.Dropdown( | |
choices=[ | |
'gemini-1.5-flash', # Fast and versatile performance | |
'gemini-1.5-flash-8b', # High volume, lower intelligence tasks | |
'gemini-1.5-pro', # Complex reasoning tasks | |
'gemini-exp-1114' # Quality improvements | |
], | |
value='gemini-1.5-pro', # Default to the most advanced model | |
label="Select Gemini Model", | |
interactive=True | |
) | |
gemini_interface = gr.load( | |
name=gemini_model.value, | |
src=gemini_gradio.registry, | |
fill_height=True, | |
chatbot=gr.Chatbot(height=250, type="messages") | |
) | |
def update_gemini_model(new_model): | |
return gr.load( | |
name=new_model, | |
src=gemini_gradio.registry, | |
fill_height=True, | |
chatbot=gr.Chatbot(type="messages") | |
) | |
gemini_model.change( | |
fn=update_gemini_model, | |
inputs=[gemini_model], | |
outputs=[gemini_interface] | |
) | |
demo.launch(ssr_mode=False) | |