Ryouko commited on
Update app.py
Browse files
app.py
CHANGED
|
@@ -98,18 +98,8 @@ def bot_streaming(message, history, api_key, model, system_prompt, temperature,
|
|
| 98 |
|
| 99 |
|
| 100 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 101 |
-
gr.Markdown(""
|
| 102 |
-
#
|
| 103 |
-
|
| 104 |
-
Chat with Google Gemini AI models. Supports text and image interactions.
|
| 105 |
-
|
| 106 |
-
## π Quick Start:
|
| 107 |
-
1. Enter your Google AI API key
|
| 108 |
-
2. Choose a model
|
| 109 |
-
3. Start chatting!
|
| 110 |
-
|
| 111 |
-
Enjoy your AI-powered conversation!
|
| 112 |
-
""")
|
| 113 |
|
| 114 |
api_key = gr.Textbox(label="API Key", type="password", placeholder="Enter your Google AI API key")
|
| 115 |
model = gr.Dropdown(
|
|
@@ -130,28 +120,45 @@ with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
|
| 130 |
)
|
| 131 |
system_prompt = gr.Textbox(label="System Prompt", placeholder="Enter a system prompt (optional)")
|
| 132 |
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
|
| 136 |
-
|
| 137 |
-
|
| 138 |
-
|
| 139 |
-
|
| 140 |
-
|
| 141 |
-
|
| 142 |
-
|
| 143 |
-
|
| 144 |
-
|
| 145 |
-
|
| 146 |
-
|
| 147 |
-
|
| 148 |
-
|
| 149 |
-
|
| 150 |
-
multimodal=True,
|
| 151 |
-
cache_examples=False,
|
| 152 |
-
fill_height=True,
|
| 153 |
)
|
| 154 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
gr.Markdown("""
|
| 156 |
## π§ Settings:
|
| 157 |
- Adjust basic parameters in the "Common Settings" section
|
|
|
|
| 98 |
|
| 99 |
|
| 100 |
with gr.Blocks(theme=gr.themes.Soft()) as demo:
|
| 101 |
+
gr.Markdown("#π¬ Chat with Google Gemini AI ")
|
| 102 |
+
gr.Markdown("### Upload images or type your message to start the conversation.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
|
| 104 |
api_key = gr.Textbox(label="API Key", type="password", placeholder="Enter your Google AI API key")
|
| 105 |
model = gr.Dropdown(
|
|
|
|
| 120 |
)
|
| 121 |
system_prompt = gr.Textbox(label="System Prompt", placeholder="Enter a system prompt (optional)")
|
| 122 |
|
| 123 |
+
chatbot = gr.ChatInterface(
|
| 124 |
+
fn=bot_streaming,
|
| 125 |
+
additional_inputs=[
|
| 126 |
+
api_key, model, system_prompt, gr.Slider(minimum=0, maximum=1, value=0.7, step=0.1, label="Temperature"),
|
| 127 |
+
gr.Slider(minimum=1, maximum=2048, value=1000, step=1, label="Max Tokens"), gr.Slider(minimum=0, maximum=1, value=0.95, step=0.01, label="Top P"),
|
| 128 |
+
gr.Slider(minimum=1, maximum=40, value=40, step=1, label="Top K"),
|
| 129 |
+
gr.Dropdown(label="Harassment", choices=["BLOCK_NONE", "BLOCK_ONLY_HIGH", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_LOW_AND_ABOVE"], value="BLOCK_MEDIUM_AND_ABOVE"),
|
| 130 |
+
gr.Dropdown(label="Hate Speech", choices=["BLOCK_NONE", "BLOCK_ONLY_HIGH", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_LOW_AND_ABOVE"], value="BLOCK_MEDIUM_AND_ABOVE"),
|
| 131 |
+
gr.Dropdown(label="Sexually Explicit", choices=["BLOCK_NONE", "BLOCK_ONLY_HIGH", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_LOW_AND_ABOVE"], value="BLOCK_MEDIUM_AND_ABOVE"),
|
| 132 |
+
gr.Dropdown(label="Dangerous Content", choices=["BLOCK_NONE", "BLOCK_ONLY_HIGH", "BLOCK_MEDIUM_AND_ABOVE", "BLOCK_LOW_AND_ABOVE"], value="BLOCK_MEDIUM_AND_ABOVE")
|
| 133 |
+
],
|
| 134 |
+
retry_btn="π Retry",
|
| 135 |
+
undo_btn="β©οΈ Undo",
|
| 136 |
+
clear_btn="ποΈ Clear",
|
| 137 |
+
multimodal=True,
|
| 138 |
+
cache_examples=False,
|
| 139 |
+
fill_height=True,
|
|
|
|
|
|
|
|
|
|
| 140 |
)
|
| 141 |
|
| 142 |
+
|
| 143 |
+
|
| 144 |
+
|
| 145 |
+
|
| 146 |
+
|
| 147 |
+
gr.Markdown("""
|
| 148 |
+
# π€ Google Gemini API Multimodal Chat
|
| 149 |
+
|
| 150 |
+
Chat with Google Gemini AI models. Supports text and image interactions.
|
| 151 |
+
|
| 152 |
+
## π Quick Start:
|
| 153 |
+
1. Enter your Google AI API key
|
| 154 |
+
2. Choose a model
|
| 155 |
+
3. Start chatting!
|
| 156 |
+
|
| 157 |
+
Enjoy your AI-powered conversation!
|
| 158 |
+
""")
|
| 159 |
+
|
| 160 |
+
|
| 161 |
+
|
| 162 |
gr.Markdown("""
|
| 163 |
## π§ Settings:
|
| 164 |
- Adjust basic parameters in the "Common Settings" section
|