Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -160,12 +160,22 @@ chatbot_component_text_only = gr.Chatbot(label='Gemini Text Only', scale=2, heig
|
|
| 160 |
text_prompt_component = gr.Textbox(placeholder="Message...", show_label=False, autofocus=True, scale=8)
|
| 161 |
run_button_component = gr.Button(value="Run", variant="primary", scale=1)
|
| 162 |
upload_button_component = gr.UploadButton(label="Upload Images", file_count="multiple", file_types=["image"], scale=1)
|
| 163 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 164 |
choices=["gemini-1.5-flash", "gemini-2.0-flash-exp", "gemini-1.5-pro"],
|
| 165 |
value="gemini-1.5-flash",
|
| 166 |
label="Select Model",
|
| 167 |
scale=2
|
| 168 |
)
|
|
|
|
| 169 |
system_instruction_component = gr.Textbox(
|
| 170 |
placeholder="Enter system instruction...",
|
| 171 |
show_label=True,
|
|
@@ -178,7 +188,7 @@ with gr.Blocks() as demo:
|
|
| 178 |
with gr.Tabs():
|
| 179 |
with gr.TabItem("Chatbot with Images"):
|
| 180 |
with gr.Column():
|
| 181 |
-
|
| 182 |
chatbot_component_with_images.render()
|
| 183 |
with gr.Row():
|
| 184 |
text_prompt_component.render()
|
|
@@ -194,7 +204,7 @@ with gr.Blocks() as demo:
|
|
| 194 |
queue=False
|
| 195 |
).then(
|
| 196 |
fn=bot,
|
| 197 |
-
inputs=[upload_button_component,
|
| 198 |
outputs=[chatbot_component_with_images],
|
| 199 |
)
|
| 200 |
|
|
@@ -207,7 +217,7 @@ with gr.Blocks() as demo:
|
|
| 207 |
|
| 208 |
with gr.TabItem("Chatbot Text Only"):
|
| 209 |
with gr.Column():
|
| 210 |
-
|
| 211 |
chatbot_component_text_only.render()
|
| 212 |
with gr.Row():
|
| 213 |
text_prompt_component.render()
|
|
@@ -217,13 +227,13 @@ with gr.Blocks() as demo:
|
|
| 217 |
|
| 218 |
run_button_component.click(
|
| 219 |
fn=bot_response,
|
| 220 |
-
inputs=[
|
| 221 |
outputs=[chatbot_component_text_only, text_prompt_component],
|
| 222 |
)
|
| 223 |
|
| 224 |
text_prompt_component.submit(
|
| 225 |
fn=bot_response,
|
| 226 |
-
inputs=[
|
| 227 |
outputs=[chatbot_component_text_only, text_prompt_component],
|
| 228 |
)
|
| 229 |
|
|
|
|
| 160 |
text_prompt_component = gr.Textbox(placeholder="Message...", show_label=False, autofocus=True, scale=8)
|
| 161 |
run_button_component = gr.Button(value="Run", variant="primary", scale=1)
|
| 162 |
upload_button_component = gr.UploadButton(label="Upload Images", file_count="multiple", file_types=["image"], scale=1)
|
| 163 |
+
|
| 164 |
+
# Componentes separados para cada pestaña
|
| 165 |
+
model_choice_component_text_only = gr.Dropdown(
|
| 166 |
+
choices=["gemini-1.5-flash", "gemini-2.0-flash-exp", "gemini-1.5-pro"],
|
| 167 |
+
value="gemini-1.5-flash",
|
| 168 |
+
label="Select Model",
|
| 169 |
+
scale=2
|
| 170 |
+
)
|
| 171 |
+
|
| 172 |
+
model_choice_component_with_images = gr.Dropdown(
|
| 173 |
choices=["gemini-1.5-flash", "gemini-2.0-flash-exp", "gemini-1.5-pro"],
|
| 174 |
value="gemini-1.5-flash",
|
| 175 |
label="Select Model",
|
| 176 |
scale=2
|
| 177 |
)
|
| 178 |
+
|
| 179 |
system_instruction_component = gr.Textbox(
|
| 180 |
placeholder="Enter system instruction...",
|
| 181 |
show_label=True,
|
|
|
|
| 188 |
with gr.Tabs():
|
| 189 |
with gr.TabItem("Chatbot with Images"):
|
| 190 |
with gr.Column():
|
| 191 |
+
model_choice_component_with_images.render()
|
| 192 |
chatbot_component_with_images.render()
|
| 193 |
with gr.Row():
|
| 194 |
text_prompt_component.render()
|
|
|
|
| 204 |
queue=False
|
| 205 |
).then(
|
| 206 |
fn=bot,
|
| 207 |
+
inputs=[upload_button_component, model_choice_component_with_images, system_instruction_component, chatbot_component_with_images],
|
| 208 |
outputs=[chatbot_component_with_images],
|
| 209 |
)
|
| 210 |
|
|
|
|
| 217 |
|
| 218 |
with gr.TabItem("Chatbot Text Only"):
|
| 219 |
with gr.Column():
|
| 220 |
+
model_choice_component_text_only.render()
|
| 221 |
chatbot_component_text_only.render()
|
| 222 |
with gr.Row():
|
| 223 |
text_prompt_component.render()
|
|
|
|
| 227 |
|
| 228 |
run_button_component.click(
|
| 229 |
fn=bot_response,
|
| 230 |
+
inputs=[model_choice_component_text_only, system_instruction_component, text_prompt_component, chatbot_component_text_only],
|
| 231 |
outputs=[chatbot_component_text_only, text_prompt_component],
|
| 232 |
)
|
| 233 |
|
| 234 |
text_prompt_component.submit(
|
| 235 |
fn=bot_response,
|
| 236 |
+
inputs=[model_choice_component_text_only, system_instruction_component, text_prompt_component, chatbot_component_text_only],
|
| 237 |
outputs=[chatbot_component_text_only, text_prompt_component],
|
| 238 |
)
|
| 239 |
|