File size: 1,480 Bytes
446d2fd
544ecfa
446d2fd
544ecfa
339f3c1
544ecfa
c163d83
544ecfa
 
 
 
 
 
 
 
 
 
 
339f3c1
544ecfa
 
 
 
b586605
544ecfa
 
 
 
 
 
 
c35f434
544ecfa
 
 
 
 
 
 
339f3c1
544ecfa
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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)