k-mktr commited on
Commit
4ceb2fd
1 Parent(s): e5f71fb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -3
app.py CHANGED
@@ -19,6 +19,7 @@ from fun_stats import get_fun_stats
19
  import threading
20
  import time
21
  from collections import Counter
 
22
 
23
 
24
  # Initialize logging for errors only
@@ -37,12 +38,21 @@ def get_available_models():
37
  def call_ollama_api(model, prompt):
38
  payload = {
39
  "model": model,
40
- "messages": [{"role": "user", "content": prompt}],
 
 
 
 
 
 
 
 
 
41
  }
42
  try:
43
  response = requests.post(
44
- f"{arena_config.API_URL}/v1/chat/completions",
45
- headers=arena_config.HEADERS,
46
  json=payload,
47
  timeout=100
48
  )
@@ -456,6 +466,41 @@ with gr.Blocks(css="""
456
  refresh_btn = gr.Button("Refresh Stats")
457
  fun_stats_html = gr.HTML(label="Fun Arena Stats")
458
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
459
  # Define interactions
460
  submit_btn.click(
461
  battle_arena,
 
19
  import threading
20
  import time
21
  from collections import Counter
22
+ from model_suggestions import add_suggestion, get_suggestions_html
23
 
24
 
25
  # Initialize logging for errors only
 
38
  def call_ollama_api(model, prompt):
39
  payload = {
40
  "model": model,
41
+ "messages": [
42
+ {
43
+ "role": "system",
44
+ "content": "You are a helpful assistant. At no point should you reveal your name, identity or team affiliation to the user, especially if asked directly!"
45
+ },
46
+ {
47
+ "role": "user",
48
+ "content": prompt
49
+ }
50
+ ]
51
  }
52
  try:
53
  response = requests.post(
54
+ f"{arena_config.API_URL}/v1/chat/completions",
55
+ headers=arena_config.HEADERS,
56
  json=payload,
57
  timeout=100
58
  )
 
466
  refresh_btn = gr.Button("Refresh Stats")
467
  fun_stats_html = gr.HTML(label="Fun Arena Stats")
468
 
469
+ # Add this new tab
470
+ with gr.Tab("Suggest Models"):
471
+ with gr.Row():
472
+ model_url_input = gr.Textbox(
473
+ label="Model URL",
474
+ placeholder="hf.co/username/model-name-GGUF:Q4_K_M",
475
+ scale=4
476
+ )
477
+ submit_suggestion_btn = gr.Button("Submit Suggestion", scale=1, variant="primary")
478
+
479
+ suggestion_status = gr.Markdown("Submit a model to see it listed below!")
480
+ suggestions_list = gr.HTML(get_suggestions_html())
481
+ refresh_suggestions_btn = gr.Button("Refresh List")
482
+
483
+ # Update button click handlers
484
+ submit_suggestion_btn.click(
485
+ add_suggestion,
486
+ inputs=[model_url_input],
487
+ outputs=[suggestion_status]
488
+ ).then(
489
+ lambda: (
490
+ get_suggestions_html(), # Update suggestions list
491
+ "" # Clear model URL input
492
+ ),
493
+ outputs=[
494
+ suggestions_list,
495
+ model_url_input
496
+ ]
497
+ )
498
+
499
+ refresh_suggestions_btn.click(
500
+ get_suggestions_html,
501
+ outputs=[suggestions_list]
502
+ )
503
+
504
  # Define interactions
505
  submit_btn.click(
506
  battle_arena,