Update app.py
Browse files
app.py
CHANGED
@@ -125,7 +125,7 @@ def user_message(msg: str, history: list) -> tuple[str, list]:
|
|
125 |
|
126 |
|
127 |
# Create the Gradio interface
|
128 |
-
with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", neutral_hue="neutral")) as demo:
|
129 |
gr.Markdown("# Gemini 2.0 Flash 'Thinking' Chatbot 💭")
|
130 |
|
131 |
chatbot = gr.Chatbot(
|
@@ -146,6 +146,23 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", n
|
|
146 |
|
147 |
clear_button = gr.Button("Clear Chat", scale=1)
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
# Set up event handlers
|
150 |
msg_store = gr.State("") # Store for preserving user message
|
151 |
|
@@ -178,16 +195,20 @@ with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", n
|
|
178 |
### About this Chatbot
|
179 |
This chatbot demonstrates the experimental 'thinking' capability of the **Gemini 2.0 Flash** model.
|
180 |
You can observe the model's thought process as it generates responses, displayed with the "⚙️ Thinking" prefix.
|
|
|
|
|
|
|
181 |
**Key Features:**
|
182 |
* Powered by Google's **Gemini 2.0 Flash** model.
|
183 |
* Shows the model's **thoughts** before the final answer (experimental feature).
|
184 |
* Supports **conversation history** for multi-turn chats.
|
185 |
* Uses **streaming** for a more interactive experience.
|
186 |
**Instructions:**
|
187 |
-
1. Type your message in the input box below.
|
188 |
2. Press Enter or click Submit to send.
|
189 |
3. Observe the chatbot's "Thinking" process followed by the final response.
|
190 |
4. Use the "Clear Chat" button to start a new conversation.
|
|
|
191 |
*Please note*: The 'thinking' feature is experimental and the quality of thoughts may vary.
|
192 |
"""
|
193 |
)
|
|
|
125 |
|
126 |
|
127 |
# Create the Gradio interface
|
128 |
+
with gr.Blocks(theme=gr.themes.Soft(primary_hue="teal", secondary_hue="slate", neutral_hue="neutral")) as demo:
|
129 |
gr.Markdown("# Gemini 2.0 Flash 'Thinking' Chatbot 💭")
|
130 |
|
131 |
chatbot = gr.Chatbot(
|
|
|
146 |
|
147 |
clear_button = gr.Button("Clear Chat", scale=1)
|
148 |
|
149 |
+
# Add example prompts
|
150 |
+
example_prompts = [
|
151 |
+
["Write a short poem about the sunset."],
|
152 |
+
["Explain the theory of relativity in simple terms."],
|
153 |
+
["If a train leaves Chicago at 6am traveling at 60mph, and another train leaves New York at 8am traveling at 80mph, at what time will they meet?"],
|
154 |
+
["Summarize the plot of Hamlet."],
|
155 |
+
["Write a haiku about a cat."]
|
156 |
+
]
|
157 |
+
|
158 |
+
gr.Examples(
|
159 |
+
examples=example_prompts,
|
160 |
+
inputs=input_box,
|
161 |
+
label="Examples: Get Gemini to show its thinking process with these prompts!",
|
162 |
+
examples_per_page=5 # Adjust as needed
|
163 |
+
)
|
164 |
+
|
165 |
+
|
166 |
# Set up event handlers
|
167 |
msg_store = gr.State("") # Store for preserving user message
|
168 |
|
|
|
195 |
### About this Chatbot
|
196 |
This chatbot demonstrates the experimental 'thinking' capability of the **Gemini 2.0 Flash** model.
|
197 |
You can observe the model's thought process as it generates responses, displayed with the "⚙️ Thinking" prefix.
|
198 |
+
|
199 |
+
**Try out the example prompts below to see Gemini in action!**
|
200 |
+
|
201 |
**Key Features:**
|
202 |
* Powered by Google's **Gemini 2.0 Flash** model.
|
203 |
* Shows the model's **thoughts** before the final answer (experimental feature).
|
204 |
* Supports **conversation history** for multi-turn chats.
|
205 |
* Uses **streaming** for a more interactive experience.
|
206 |
**Instructions:**
|
207 |
+
1. Type your message in the input box below or select an example.
|
208 |
2. Press Enter or click Submit to send.
|
209 |
3. Observe the chatbot's "Thinking" process followed by the final response.
|
210 |
4. Use the "Clear Chat" button to start a new conversation.
|
211 |
+
|
212 |
*Please note*: The 'thinking' feature is experimental and the quality of thoughts may vary.
|
213 |
"""
|
214 |
)
|