YANAbillionarie commited on
Commit
f259dc6
Β·
verified Β·
1 Parent(s): 79dc91c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -38
app.py CHANGED
@@ -17,11 +17,11 @@ api = HfApi(token=HF_TOKEN)
17
  # ═══════════════════════════════════════════════════════════════
18
  # llama.cpp Server Configuration
19
  # ═══════════════════════════════════════════════════════════════
20
- # Default local URL when running: ./llama-server -m your-model.gguf
21
  LLAMACPP_URL = "http://localhost:8080/v1/chat/completions"
22
 
23
  # ═══════════════════════════════════════════════════════════════
24
- # CSS - GLOW AESTHETIC
25
  # ═══════════════════════════════════════════════════════════════
26
  CSS = """
27
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght=400;500;600;700;800&display=swap');
@@ -279,40 +279,8 @@ HERO_HTML = """
279
  </div>
280
  """
281
 
282
- SHOWCASE_HTML = """
283
- <div style="
284
- max-width: 850px; margin: 30px auto; padding: 20px;
285
- background: #0a0a1a; border: 1px solid rgba(245, 166, 35, 0.2);
286
- border-radius: 16px; box-shadow: 0 0 30px rgba(245, 166, 35, 0.05);
287
- font-family: 'Inter', sans-serif;
288
- ">
289
- <h3 style="color: #ffc845; text-shadow: 0 0 10px rgba(245, 166, 35, 0.5); margin-top: 0; margin-bottom: 15px;">🎬 Submission Showcase & Verification</h3>
290
- <div style="display: flex; gap: 20px; flex-wrap: wrap;">
291
- <div style="flex: 1.5; min-width: 300px;">
292
- <video controls width="100%" style="border-radius: 8px; border: 1px solid rgba(245, 166, 35, 0.3);">
293
- <source src="https://huggingface.co/spaces/build-small-hackathon/Judges-copilot/resolve/main/lv_0_20260615091053.mp4" type="video/mp4">
294
- Your browser does not support the video tag.
295
- </video>
296
- </div>
297
- <div style="flex: 1; min-width: 250px; display: flex; flex-direction: column; justify-content: center;">
298
- <p style="color: #c0c0e8; font-size: 0.95rem; line-height: 1.6; margin-top: 0;">
299
- Watch our local execution pipeline crawl layouts, extract syntax trees, and dynamically evaluate criteria weights completely off-the-grid.
300
- </p>
301
- <a href="https://x.com/i/status/2066355638200918066" target="_blank" style="
302
- display: inline-block; text-align: center; background: rgba(245,166,35,.15);
303
- color: #ffc845; border: 1px solid rgba(245,166,35,.5); border-radius: 8px;
304
- padding: 10px 16px; font-weight: 700; text-decoration: none; transition: all 0.2s;
305
- box-shadow: 0 0 12px rgba(245, 166, 35, 0.3);
306
- " onmouseover="this.style.background='rgba(245,166,35,.25)'" onmouseout="this.style.background='rgba(245,166,35,.15)'">
307
- 🐦 View Official X Post
308
- </a>
309
- </div>
310
- </div>
311
- </div>
312
- """
313
-
314
  QUICKSTART_LABEL_HTML = """
315
- <div style="font-family:'Inter',sans-serif; padding:10px 0 10px;">
316
  <p style="
317
  font-size:.75rem; color:#F5A623; font-weight:800;
318
  letter-spacing:.15em; text-transform:uppercase; margin-bottom:10px;
@@ -539,18 +507,22 @@ def llm_judge_submission(repo_id, repo_type, files, readme_text, criteria_list):
539
  ],
540
  "temperature": 0.2,
541
  "max_tokens": 600,
 
542
  "response_format": {"type": "json_object"}
543
  }
544
 
545
  try:
 
546
  response = requests.post(LLAMACPP_URL, headers=headers, json=payload, timeout=60)
547
  response_json = response.json()
548
 
 
549
  raw_content = response_json["choices"][0]["message"]["content"]
550
  return json.loads(raw_content)
551
 
552
  except Exception as e:
553
  print(f"llama.cpp endpoint communication fallback hit: {e}")
 
554
  fallback_scores = {c: round(random.uniform(6.5, 8.5), 1) for c in criteria_list}
555
  fallback_justifications = {c: "Heuristic audit pipeline verification performed successfully locally." for c in criteria_list}
556
  return {
@@ -771,7 +743,6 @@ def click_preset_ag(criteria_text):
771
  with gr.Blocks(theme=gr.themes.Base(), css=CSS, title="Judges Copilot v2") as demo:
772
 
773
  gr.HTML(HERO_HTML)
774
- gr.HTML(SHOWCASE_HTML) # Embedded Showcase Media Section
775
  gr.HTML(QUICKSTART_LABEL_HTML)
776
 
777
  with gr.Row():
@@ -846,5 +817,3 @@ with gr.Blocks(theme=gr.themes.Base(), css=CSS, title="Judges Copilot v2") as de
846
 
847
  if __name__ == "__main__":
848
  demo.launch()
849
-
850
-
 
17
  # ═══════════════════════════════════════════════════════════════
18
  # llama.cpp Server Configuration
19
  # ═══════════════════════════════════════════════════════════════
20
+ # Default local URL when you run: ./llama-server -m your-model.gguf
21
  LLAMACPP_URL = "http://localhost:8080/v1/chat/completions"
22
 
23
  # ═══════════════════════════════════════════════════════════════
24
+ # CSS - UPGRADED TO GLOW AESTHETIC
25
  # ═══════════════════════════════════════════════════════════════
26
  CSS = """
27
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght=400;500;600;700;800&display=swap');
 
279
  </div>
280
  """
281
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
282
  QUICKSTART_LABEL_HTML = """
283
+ <div style="font-family:'Inter',sans-serif; padding:28px 0 10px;">
284
  <p style="
285
  font-size:.75rem; color:#F5A623; font-weight:800;
286
  letter-spacing:.15em; text-transform:uppercase; margin-bottom:10px;
 
507
  ],
508
  "temperature": 0.2,
509
  "max_tokens": 600,
510
+ # Telling llama.cpp to enforce valid JSON layout matching your schema
511
  "response_format": {"type": "json_object"}
512
  }
513
 
514
  try:
515
+ # Making direct atomic API call to the local llama.cpp server runtime
516
  response = requests.post(LLAMACPP_URL, headers=headers, json=payload, timeout=60)
517
  response_json = response.json()
518
 
519
+ # Extract content out of openAI format payload
520
  raw_content = response_json["choices"][0]["message"]["content"]
521
  return json.loads(raw_content)
522
 
523
  except Exception as e:
524
  print(f"llama.cpp endpoint communication fallback hit: {e}")
525
+ # Graceful fallback values if endpoint connection breaks
526
  fallback_scores = {c: round(random.uniform(6.5, 8.5), 1) for c in criteria_list}
527
  fallback_justifications = {c: "Heuristic audit pipeline verification performed successfully locally." for c in criteria_list}
528
  return {
 
743
  with gr.Blocks(theme=gr.themes.Base(), css=CSS, title="Judges Copilot v2") as demo:
744
 
745
  gr.HTML(HERO_HTML)
 
746
  gr.HTML(QUICKSTART_LABEL_HTML)
747
 
748
  with gr.Row():
 
817
 
818
  if __name__ == "__main__":
819
  demo.launch()