|
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', |
|
'gemini-1.5-flash-8b', |
|
'gemini-1.5-pro', |
|
'gemini-exp-1114' |
|
], |
|
value='gemini-1.5-pro', |
|
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(height=250, type="messages") |
|
) |
|
|
|
gemini_model.change( |
|
fn=update_gemini_model, |
|
inputs=[gemini_model], |
|
outputs=[gemini_interface] |
|
) |
|
|
|
demo.launch(ssr_mode=False) |
|
|