Ryouko commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -112,24 +112,22 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 112 |
""")
|
| 113 |
|
| 114 |
with gr.Row():
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
| 118 |
-
|
| 119 |
-
|
| 120 |
-
|
| 121 |
-
|
| 122 |
-
|
| 123 |
-
|
| 124 |
-
|
| 125 |
-
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
with gr.Column(scale=1):
|
| 132 |
-
api_key = gr.Textbox(label="API Key", type="password", placeholder="Enter your Google AI API key")
|
| 133 |
model = gr.Dropdown(
|
| 134 |
label="Select Model",
|
| 135 |
choices=[
|
|
@@ -148,6 +146,7 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 148 |
)
|
| 149 |
system_prompt = gr.Textbox(label="System Prompt", placeholder="Enter a system prompt (optional)")
|
| 150 |
|
|
|
|
| 151 |
with gr.Accordion("Common Settings", open=False):
|
| 152 |
temperature = gr.Slider(minimum=0, maximum=1, value=0.7, step=0.1, label="Temperature")
|
| 153 |
max_tokens = gr.Slider(minimum=1, maximum=2048, value=1000, step=1, label="Max Tokens")
|
|
|
|
| 112 |
""")
|
| 113 |
|
| 114 |
with gr.Row():
|
| 115 |
+
chatbot = gr.ChatInterface(
|
| 116 |
+
fn=bot_streaming,
|
| 117 |
+
additional_inputs=[
|
| 118 |
+
api_key, model, system_prompt, temperature, max_tokens, top_p, top_k,
|
| 119 |
+
harassment, hate_speech, sexually_explicit, dangerous_content
|
| 120 |
+
],
|
| 121 |
+
title="💬 Chat with Google Gemini AI",
|
| 122 |
+
description="Upload images or type your message to start the conversation.",
|
| 123 |
+
retry_btn="🔄 Retry",
|
| 124 |
+
undo_btn="↩️ Undo",
|
| 125 |
+
clear_btn="🗑️ Clear",
|
| 126 |
+
multimodal=True,
|
| 127 |
+
cache_examples=False,
|
| 128 |
+
fill_height=True,
|
| 129 |
+
)
|
| 130 |
+
api_key = gr.Textbox(label="API Key", type="password", placeholder="Enter your Google AI API key")
|
|
|
|
|
|
|
| 131 |
model = gr.Dropdown(
|
| 132 |
label="Select Model",
|
| 133 |
choices=[
|
|
|
|
| 146 |
)
|
| 147 |
system_prompt = gr.Textbox(label="System Prompt", placeholder="Enter a system prompt (optional)")
|
| 148 |
|
| 149 |
+
with gr.Column(scale=1):
|
| 150 |
with gr.Accordion("Common Settings", open=False):
|
| 151 |
temperature = gr.Slider(minimum=0, maximum=1, value=0.7, step=0.1, label="Temperature")
|
| 152 |
max_tokens = gr.Slider(minimum=1, maximum=2048, value=1000, step=1, label="Max Tokens")
|