Nymbo commited on
Commit
ebfa7a7
·
verified ·
1 Parent(s): 81fd32e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +64 -133
app.py CHANGED
@@ -99,139 +99,6 @@ def respond(
99
  # GRADIO UI CONFIGURATION
100
  # -------------------------
101
 
102
- # -----------
103
- # ADDING THE "INFORMATION" TAB
104
- # -----------
105
- with gr.Tab("Information"):
106
- with gr.Row():
107
- # Accordion for Featured Models
108
- with gr.Accordion("Featured Models", open=False):
109
- gr.HTML(
110
- """
111
- <table style="width:100%; text-align:center; margin:auto;">
112
- <tr>
113
- <th>Model Name</th>
114
- <th>Typography</th>
115
- <th>Notes</th>
116
- </tr>
117
- <tr>
118
- <td>meta-llama/Llama-3.3-70B-Instruct</td>
119
- <td>✅</td>
120
- <td></td>
121
- </tr>
122
- <tr>
123
- <td>meta-llama/Llama-3.2-3B-Instruct</td>
124
- <td>✅</td>
125
- <td></td>
126
- </tr>
127
- <tr>
128
- <td>meta-llama/Llama-3.2-1B-Instruct</td>
129
- <td>✅</td>
130
- <td></td>
131
- </tr>
132
- <tr>
133
- <td>meta-llama/Llama-3.1-8B-Instruct</td>
134
- <td>✅</td>
135
- <td></td>
136
- </tr>
137
- <tr>
138
- <td>NousResearch/Hermes-3-Llama-3.1-8B</td>
139
- <td>✅</td>
140
- <td></td>
141
- </tr>
142
- <tr>
143
- <td>google/gemma-2-27b-it</td>
144
- <td>✅</td>
145
- <td></td>
146
- </tr>
147
- <tr>
148
- <td>google/gemma-2-9b-it</td>
149
- <td>✅</td>
150
- <td></td>
151
- </tr>
152
- <tr>
153
- <td>google/gemma-2-2b-it</td>
154
- <td>✅</td>
155
- <td></td>
156
- </tr>
157
- <tr>
158
- <td>mistralai/Mistral-Nemo-Instruct-2407</td>
159
- <td>✅</td>
160
- <td></td>
161
- </tr>
162
- <tr>
163
- <td>mistralai/Mixtral-8x7B-Instruct-v0.1</td>
164
- <td>✅</td>
165
- <td></td>
166
- </tr>
167
- <tr>
168
- <td>mistralai/Mistral-7B-Instruct-v0.3</td>
169
- <td>✅</td>
170
- <td></td>
171
- </tr>
172
- <tr>
173
- <td>Qwen/Qwen2.5-72B-Instruct</td>
174
- <td>✅</td>
175
- <td></td>
176
- </tr>
177
- <tr>
178
- <td>Qwen/QwQ-32B-Preview</td>
179
- <td>✅</td>
180
- <td></td>
181
- </tr>
182
- <tr>
183
- <td>PowerInfer/SmallThinker-3B-Preview</td>
184
- <td>✅</td>
185
- <td></td>
186
- </tr>
187
- <tr>
188
- <td>HuggingFaceTB/SmolLM2-1.7B-Instruct</td>
189
- <td>✅</td>
190
- <td></td>
191
- </tr>
192
- <tr>
193
- <td>TinyLlama/TinyLlama-1.1B-Chat-v1.0</td>
194
- <td>✅</td>
195
- <td></td>
196
- </tr>
197
- <tr>
198
- <td>microsoft/Phi-3.5-mini-instruct</td>
199
- <td>✅</td>
200
- <td></td>
201
- </tr>
202
- </table>
203
- """
204
- )
205
-
206
- # Accordion for Parameters Overview
207
- with gr.Accordion("Parameters Overview", open=False):
208
- gr.Markdown(
209
- """
210
- ## System Message
211
- ###### This box is for setting the initial context or instructions for the AI. It helps guide the AI on how to respond to your inputs.
212
-
213
- ## Max New Tokens
214
- ###### This slider allows you to specify the maximum number of tokens (words or parts of words) the AI can generate in a single response. The default value is 512, and the maximum is 4096.
215
-
216
- ## Temperature
217
- ###### Temperature controls the randomness of the AI's responses. A higher temperature makes the responses more creative and varied, while a lower temperature makes them more predictable and focused. The default value is 0.7.
218
-
219
- ## Top-P (Nucleus Sampling)
220
- ###### Top-P sampling is another way to control the diversity of the AI's responses. It ensures that the AI only considers the most likely tokens up to a cumulative probability of P. The default value is 0.95.
221
-
222
- ## Frequency Penalty
223
- ###### This penalty discourages the AI from repeating the same tokens (words or phrases) in its responses. A higher penalty reduces repetition. The default value is 0.0.
224
-
225
- ## Seed
226
- ###### The seed is a number that ensures the reproducibility of the AI's responses. If you set a specific seed, the AI will generate the same response every time for the same input. If you set it to -1, the AI will generate a random seed each time.
227
-
228
- ## Custom Model
229
- ###### You can specify a custom Hugging Face model path here. This will override any selected featured model. This is optional and allows you to use models not listed in the featured models.
230
-
231
- ### Remember, these settings are all about giving you control over the text generation process. Feel free to experiment and see what each one does. And if you're ever in doubt, the default settings are a great place to start. Happy creating!
232
- """
233
- )
234
-
235
  # Create a Chatbot component with a specified height
236
  chatbot = gr.Chatbot(height=600) # Define the height of the chatbot interface
237
  print("Chatbot interface created.")
@@ -310,6 +177,70 @@ demo = gr.ChatInterface(
310
 
311
  print("ChatInterface object created.")
312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
313
  # -----------
314
  # ADDING THE "FEATURED MODELS" ACCORDION
315
  # -----------
 
99
  # GRADIO UI CONFIGURATION
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.")
 
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
  # -----------