Nymbo commited on
Commit
57fd5c0
·
verified ·
1 Parent(s): 75bf974

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +138 -145
app.py CHANGED
@@ -208,155 +208,148 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme") as demo:
208
  # Send button for messages
209
  submit_btn = gr.Button("Send", variant="primary")
210
 
211
- # Create tabs for different settings
212
  with gr.Accordion("Settings", open=False):
213
- # Tab for general settings
214
- with gr.Tab("General Settings"):
215
- # System message
216
- system_message_box = gr.Textbox(
217
- value="You are a helpful AI assistant that can understand images and text.",
218
- placeholder="You are a helpful assistant.",
219
- label="System Prompt"
220
- )
221
-
222
- # Generation parameters
223
- with gr.Row():
224
- with gr.Column():
225
- max_tokens_slider = gr.Slider(
226
- minimum=1,
227
- maximum=4096,
228
- value=512,
229
- step=1,
230
- label="Max tokens"
231
- )
232
-
233
- temperature_slider = gr.Slider(
234
- minimum=0.1,
235
- maximum=4.0,
236
- value=0.7,
237
- step=0.1,
238
- label="Temperature"
239
- )
240
-
241
- with gr.Column():
242
- top_p_slider = gr.Slider(
243
- minimum=0.1,
244
- maximum=1.0,
245
- value=0.95,
246
- step=0.05,
247
- label="Top-P"
248
- )
249
-
250
- frequency_penalty_slider = gr.Slider(
251
- minimum=-2.0,
252
- maximum=2.0,
253
- value=0.0,
254
- step=0.1,
255
- label="Frequency Penalty"
256
- )
257
-
258
- seed_slider = gr.Slider(
259
- minimum=-1,
260
- maximum=65535,
261
- value=-1,
262
- step=1,
263
- label="Seed (-1 for random)"
264
- )
265
 
266
- # Tab for provider and model selection
267
- with gr.Tab("Provider & Model"):
268
- with gr.Row():
269
- with gr.Column():
270
- # Provider selection
271
- providers_list = [
272
- "hf-inference", # Default Hugging Face Inference
273
- "cerebras", # Cerebras provider
274
- "together", # Together AI
275
- "sambanova", # SambaNova
276
- "novita", # Novita AI
277
- "cohere", # Cohere
278
- "fireworks-ai", # Fireworks AI
279
- "hyperbolic", # Hyperbolic
280
- "nebius", # Nebius
281
- ]
282
-
283
- provider_radio = gr.Radio(
284
- choices=providers_list,
285
- value="hf-inference",
286
- label="Inference Provider",
287
- info="[View all models here](https://huggingface.co/models?inference_provider=all&sort=trending)"
288
- )
289
-
290
- # New BYOK textbox
291
- byok_textbox = gr.Textbox(
292
- value="",
293
- label="BYOK (Bring Your Own Key)",
294
- info="Enter a custom Hugging Face API key here. When empty, only 'hf-inference' provider can be used.",
295
- placeholder="Enter your Hugging Face API token",
296
- type="password" # Hide the API key for security
297
- )
298
-
299
- with gr.Column():
300
- # Custom model box
301
- custom_model_box = gr.Textbox(
302
- value="",
303
- label="Custom Model",
304
- info="(Optional) Provide a custom Hugging Face model path. Overrides any selected featured model.",
305
- placeholder="meta-llama/Llama-3.3-70B-Instruct"
306
- )
307
-
308
- # Model search
309
- model_search_box = gr.Textbox(
310
- label="Filter Models",
311
- placeholder="Search for a featured model...",
312
- lines=1
313
- )
314
-
315
- # Featured models list
316
- # Updated to include multimodal models
317
- models_list = [
318
- # Multimodal models
319
- "meta-llama/Llama-3.3-70B-Vision",
320
- "Alibaba-NLP/NephilaV-16B-Chat",
321
- "mistralai/Mistral-Large-Vision-2407",
322
- "OpenGVLab/InternVL-Chat-V1-5",
323
- "microsoft/Phi-3.5-vision-instruct",
324
- "Qwen/Qwen2.5-VL-7B-Instruct",
325
- "liuhaotian/llava-v1.6-mistral-7b",
326
 
327
- # Standard text models
328
- "meta-llama/Llama-3.3-70B-Instruct",
329
- "meta-llama/Llama-3.1-70B-Instruct",
330
- "meta-llama/Llama-3.0-70B-Instruct",
331
- "meta-llama/Llama-3.2-3B-Instruct",
332
- "meta-llama/Llama-3.2-1B-Instruct",
333
- "meta-llama/Llama-3.1-8B-Instruct",
334
- "NousResearch/Hermes-3-Llama-3.1-8B",
335
- "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
336
- "mistralai/Mistral-Nemo-Instruct-2407",
337
- "mistralai/Mixtral-8x7B-Instruct-v0.1",
338
- "mistralai/Mistral-7B-Instruct-v0.3",
339
- "mistralai/Mistral-7B-Instruct-v0.2",
340
- "Qwen/Qwen3-235B-A22B",
341
- "Qwen/Qwen3-32B",
342
- "Qwen/Qwen2.5-72B-Instruct",
343
- "Qwen/Qwen2.5-3B-Instruct",
344
- "Qwen/Qwen2.5-0.5B-Instruct",
345
- "Qwen/QwQ-32B",
346
- "Qwen/Qwen2.5-Coder-32B-Instruct",
347
- "microsoft/Phi-3.5-mini-instruct",
348
- "microsoft/Phi-3-mini-128k-instruct",
349
- "microsoft/Phi-3-mini-4k-instruct",
350
- ]
351
-
352
- featured_model_radio = gr.Radio(
353
- label="Select a model below",
354
- choices=models_list,
355
- value="meta-llama/Llama-3.3-70B-Vision", # Default to a multimodal model
356
- interactive=True
357
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
 
359
- gr.Markdown("[View all multimodal models](https://huggingface.co/models?pipeline_tag=image-to-text&sort=trending)")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
 
361
  # Chat history state
362
  chat_history = gr.State([])
 
208
  # Send button for messages
209
  submit_btn = gr.Button("Send", variant="primary")
210
 
211
+ # Create accordion for settings
212
  with gr.Accordion("Settings", open=False):
213
+ # System message
214
+ system_message_box = gr.Textbox(
215
+ value="You are a helpful AI assistant that can understand images and text.",
216
+ placeholder="You are a helpful assistant.",
217
+ label="System Prompt"
218
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
 
220
+ # Generation parameters
221
+ with gr.Row():
222
+ with gr.Column():
223
+ max_tokens_slider = gr.Slider(
224
+ minimum=1,
225
+ maximum=4096,
226
+ value=512,
227
+ step=1,
228
+ label="Max tokens"
229
+ )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
230
 
231
+ temperature_slider = gr.Slider(
232
+ minimum=0.1,
233
+ maximum=4.0,
234
+ value=0.7,
235
+ step=0.1,
236
+ label="Temperature"
237
+ )
238
+
239
+ top_p_slider = gr.Slider(
240
+ minimum=0.1,
241
+ maximum=1.0,
242
+ value=0.95,
243
+ step=0.05,
244
+ label="Top-P"
245
+ )
246
+
247
+ with gr.Column():
248
+ frequency_penalty_slider = gr.Slider(
249
+ minimum=-2.0,
250
+ maximum=2.0,
251
+ value=0.0,
252
+ step=0.1,
253
+ label="Frequency Penalty"
254
+ )
255
+
256
+ seed_slider = gr.Slider(
257
+ minimum=-1,
258
+ maximum=65535,
259
+ value=-1,
260
+ step=1,
261
+ label="Seed (-1 for random)"
262
+ )
263
+
264
+ # Provider selection
265
+ providers_list = [
266
+ "hf-inference", # Default Hugging Face Inference
267
+ "cerebras", # Cerebras provider
268
+ "together", # Together AI
269
+ "sambanova", # SambaNova
270
+ "novita", # Novita AI
271
+ "cohere", # Cohere
272
+ "fireworks-ai", # Fireworks AI
273
+ "hyperbolic", # Hyperbolic
274
+ "nebius", # Nebius
275
+ ]
276
+
277
+ provider_radio = gr.Radio(
278
+ choices=providers_list,
279
+ value="hf-inference",
280
+ label="Inference Provider",
281
+ info="[View all models here](https://huggingface.co/models?inference_provider=all&sort=trending)"
282
+ )
283
+
284
+ # New BYOK textbox
285
+ byok_textbox = gr.Textbox(
286
+ value="",
287
+ label="BYOK (Bring Your Own Key)",
288
+ info="Enter a custom Hugging Face API key here. When empty, only 'hf-inference' provider can be used.",
289
+ placeholder="Enter your Hugging Face API token",
290
+ type="password" # Hide the API key for security
291
+ )
292
+
293
+ # Custom model box
294
+ custom_model_box = gr.Textbox(
295
+ value="",
296
+ label="Custom Model",
297
+ info="(Optional) Provide a custom Hugging Face model path. Overrides any selected featured model.",
298
+ placeholder="meta-llama/Llama-3.3-70B-Instruct"
299
+ )
300
+
301
+ # Model search
302
+ model_search_box = gr.Textbox(
303
+ label="Filter Models",
304
+ placeholder="Search for a featured model...",
305
+ lines=1
306
+ )
307
+
308
+ # Featured models list
309
+ # Updated to include multimodal models
310
+ models_list = [
311
+ # Multimodal models
312
+ "meta-llama/Llama-3.3-70B-Vision",
313
+ "Alibaba-NLP/NephilaV-16B-Chat",
314
+ "mistralai/Mistral-Large-Vision-2407",
315
+ "OpenGVLab/InternVL-Chat-V1-5",
316
+ "microsoft/Phi-3.5-vision-instruct",
317
+ "Qwen/Qwen2.5-VL-7B-Instruct",
318
+ "liuhaotian/llava-v1.6-mistral-7b",
319
 
320
+ # Standard text models
321
+ "meta-llama/Llama-3.3-70B-Instruct",
322
+ "meta-llama/Llama-3.1-70B-Instruct",
323
+ "meta-llama/Llama-3.0-70B-Instruct",
324
+ "meta-llama/Llama-3.2-3B-Instruct",
325
+ "meta-llama/Llama-3.2-1B-Instruct",
326
+ "meta-llama/Llama-3.1-8B-Instruct",
327
+ "NousResearch/Hermes-3-Llama-3.1-8B",
328
+ "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO",
329
+ "mistralai/Mistral-Nemo-Instruct-2407",
330
+ "mistralai/Mixtral-8x7B-Instruct-v0.1",
331
+ "mistralai/Mistral-7B-Instruct-v0.3",
332
+ "mistralai/Mistral-7B-Instruct-v0.2",
333
+ "Qwen/Qwen3-235B-A22B",
334
+ "Qwen/Qwen3-32B",
335
+ "Qwen/Qwen2.5-72B-Instruct",
336
+ "Qwen/Qwen2.5-3B-Instruct",
337
+ "Qwen/Qwen2.5-0.5B-Instruct",
338
+ "Qwen/QwQ-32B",
339
+ "Qwen/Qwen2.5-Coder-32B-Instruct",
340
+ "microsoft/Phi-3.5-mini-instruct",
341
+ "microsoft/Phi-3-mini-128k-instruct",
342
+ "microsoft/Phi-3-mini-4k-instruct",
343
+ ]
344
+
345
+ featured_model_radio = gr.Radio(
346
+ label="Select a model below",
347
+ choices=models_list,
348
+ value="meta-llama/Llama-3.3-70B-Vision", # Default to a multimodal model
349
+ interactive=True
350
+ )
351
+
352
+ gr.Markdown("[View all multimodal models](https://huggingface.co/models?pipeline_tag=image-to-text&sort=trending)")
353
 
354
  # Chat history state
355
  chat_history = gr.State([])