Spaces:
Running
Running
placeholders, copy buttons, panel layout, likeable responses
Browse files
app.py
CHANGED
|
@@ -100,7 +100,7 @@ def respond(
|
|
| 100 |
# -------------------------
|
| 101 |
|
| 102 |
# Create a Chatbot component with a specified height
|
| 103 |
-
chatbot = gr.Chatbot(height=600) # Define the height of the chatbot interface
|
| 104 |
print("Chatbot interface created.")
|
| 105 |
|
| 106 |
# Create textboxes and sliders for system prompt, tokens, and other parameters
|
|
@@ -172,75 +172,18 @@ demo = gr.ChatInterface(
|
|
| 172 |
],
|
| 173 |
fill_height=True, # Allow the chatbot to fill the container height
|
| 174 |
chatbot=chatbot, # Chatbot UI component
|
|
|
|
|
|
|
|
|
|
| 175 |
theme="Nymbo/Nymbo_Theme", # Theme for the interface
|
|
|
|
|
|
|
|
|
|
|
|
|
| 176 |
)
|
| 177 |
|
| 178 |
print("ChatInterface object created.")
|
| 179 |
|
| 180 |
-
# -----------
|
| 181 |
-
# ADDING THE INFORMATION TAB
|
| 182 |
-
# -----------
|
| 183 |
-
with demo:
|
| 184 |
-
with gr.Tab("Information"):
|
| 185 |
-
with gr.Accordion("Featured Models", open=True):
|
| 186 |
-
gr.HTML(
|
| 187 |
-
"""
|
| 188 |
-
<p><a href="https://huggingface.co/models?inference=warm&pipeline_tag=text-generation&sort=trending">See all available models</a></p>
|
| 189 |
-
<table style="width:100%; text-align:center; margin:auto;">
|
| 190 |
-
<tr>
|
| 191 |
-
<th>Model Name</th>
|
| 192 |
-
<th>Context Length</th>
|
| 193 |
-
<th>Notes</th>
|
| 194 |
-
</tr>
|
| 195 |
-
<tr>
|
| 196 |
-
<td>meta-llama/Llama-3.3-70B-Instruct</td>
|
| 197 |
-
<td>8192</td>
|
| 198 |
-
<td>Most capable model</td>
|
| 199 |
-
</tr>
|
| 200 |
-
<tr>
|
| 201 |
-
<td>meta-llama/Llama-3.2-3B-Instruct</td>
|
| 202 |
-
<td>8192</td>
|
| 203 |
-
<td>Lightweight option</td>
|
| 204 |
-
</tr>
|
| 205 |
-
<tr>
|
| 206 |
-
<td>google/gemma-2-27b-it</td>
|
| 207 |
-
<td>8192</td>
|
| 208 |
-
<td>Google's latest</td>
|
| 209 |
-
</tr>
|
| 210 |
-
<tr>
|
| 211 |
-
<td>mistralai/Mixtral-8x7B-Instruct-v0.1</td>
|
| 212 |
-
<td>32768</td>
|
| 213 |
-
<td>High context length</td>
|
| 214 |
-
</tr>
|
| 215 |
-
</table>
|
| 216 |
-
"""
|
| 217 |
-
)
|
| 218 |
-
|
| 219 |
-
with gr.Accordion("Parameters Overview", open=False):
|
| 220 |
-
gr.Markdown(
|
| 221 |
-
"""
|
| 222 |
-
## System Message
|
| 223 |
-
###### This is the initial instruction that guides the model's behavior throughout the conversation. It sets the tone and personality of the assistant.
|
| 224 |
-
|
| 225 |
-
## Max Tokens
|
| 226 |
-
###### Controls the maximum length of the generated response. Higher values allow for longer responses but may take more time to generate.
|
| 227 |
-
|
| 228 |
-
## Temperature
|
| 229 |
-
###### Controls the randomness of predictions by scaling the logits before applying softmax. Lower values make the model more deterministic.
|
| 230 |
-
|
| 231 |
-
## Top-P (Nucleus Sampling)
|
| 232 |
-
###### Controls sampling by selecting from the smallest possible set of tokens whose cumulative probability exceeds the probability p.
|
| 233 |
-
|
| 234 |
-
## Frequency Penalty
|
| 235 |
-
###### Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
|
| 236 |
-
|
| 237 |
-
## Seed
|
| 238 |
-
###### The seed value provides reproducibility. Using the same seed with the same parameters will produce the same output.
|
| 239 |
-
|
| 240 |
-
### Remember, these settings are all about giving you control over the text generation process. Feel free to experiment and see what each one does. Happy generating!
|
| 241 |
-
"""
|
| 242 |
-
)
|
| 243 |
-
|
| 244 |
# -----------
|
| 245 |
# ADDING THE "FEATURED MODELS" ACCORDION
|
| 246 |
# -----------
|
|
|
|
| 100 |
# -------------------------
|
| 101 |
|
| 102 |
# Create a Chatbot component with a specified height
|
| 103 |
+
chatbot = gr.Chatbot(height=600, show_copy_button=True, placeholder="Select a model and begin chatting", show_copy_all_button=True, likeable=True, layout="panel") # Define the height of the chatbot interface
|
| 104 |
print("Chatbot interface created.")
|
| 105 |
|
| 106 |
# Create textboxes and sliders for system prompt, tokens, and other parameters
|
|
|
|
| 172 |
],
|
| 173 |
fill_height=True, # Allow the chatbot to fill the container height
|
| 174 |
chatbot=chatbot, # Chatbot UI component
|
| 175 |
+
textbox=gr.MultimodalTextbox(),
|
| 176 |
+
multimodal=True,
|
| 177 |
+
concurrency_limit=20,
|
| 178 |
theme="Nymbo/Nymbo_Theme", # Theme for the interface
|
| 179 |
+
examples=[{"text": "Howdy, partner!",},
|
| 180 |
+
{"text": "What's your model name and who trained you?",},
|
| 181 |
+
{"text": "How many R's are there in the word Strawberry?"},],
|
| 182 |
+
cache_examples=False
|
| 183 |
)
|
| 184 |
|
| 185 |
print("ChatInterface object created.")
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
# -----------
|
| 188 |
# ADDING THE "FEATURED MODELS" ACCORDION
|
| 189 |
# -----------
|