Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Alina Lozovskaya
commited on
Commit
ยท
e3a07b7
1
Parent(s):
7ccf9d4
Add citations
Browse files- yourbench_space/app.py +33 -2
- yourbench_space/docs.md +10 -0
yourbench_space/app.py
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
-
import time
|
| 4 |
import gradio as gr
|
| 5 |
import yaml
|
|
|
|
| 6 |
from loguru import logger
|
| 7 |
from huggingface_hub import whoami
|
| 8 |
|
|
@@ -14,6 +15,18 @@ from yourbench_space.utils import (
|
|
| 14 |
save_files,
|
| 15 |
)
|
| 16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
UPLOAD_DIRECTORY.mkdir(parents=True, exist_ok=True)
|
| 18 |
|
| 19 |
logger.remove()
|
|
@@ -22,9 +35,20 @@ logger.add(sys.stderr, level="INFO")
|
|
| 22 |
command = ["uv", "run", "yourbench", f"--config={CONFIG_PATH}"]
|
| 23 |
manager = SubprocessManager(command)
|
| 24 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
def generate_and_return(hf_org, hf_prefix):
|
| 26 |
"""Handles config generation and validates file existence before enabling download"""
|
| 27 |
-
generate_and_save_config(hf_org, hf_prefix)
|
| 28 |
|
| 29 |
# Wait until the config file is actually created
|
| 30 |
for _ in range(5):
|
|
@@ -68,6 +92,8 @@ def enable_button(files):
|
|
| 68 |
|
| 69 |
|
| 70 |
with gr.Blocks() as app:
|
|
|
|
|
|
|
| 71 |
gr.Markdown("## YourBench Setup")
|
| 72 |
|
| 73 |
with gr.Row():
|
|
@@ -118,4 +144,9 @@ with gr.Blocks() as app:
|
|
| 118 |
kill_button = gr.Button("Kill Task")
|
| 119 |
kill_button.click(manager.kill_process)
|
| 120 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 121 |
app.launch(allowed_paths=["/app"])
|
|
|
|
| 1 |
import os
|
| 2 |
import sys
|
| 3 |
+
import time
|
| 4 |
import gradio as gr
|
| 5 |
import yaml
|
| 6 |
+
from pathlib import Path
|
| 7 |
from loguru import logger
|
| 8 |
from huggingface_hub import whoami
|
| 9 |
|
|
|
|
| 15 |
save_files,
|
| 16 |
)
|
| 17 |
|
| 18 |
+
# Short project description
|
| 19 |
+
project_description = """
|
| 20 |
+
# YourBench ๐
|
| 21 |
+
A Dynamic Benchmark Generation Framework
|
| 22 |
+
- Produce diverse, up-to-date questions from real-world source documents
|
| 23 |
+
- Seamlessly handles ingestion, summarization, and multi-hop chunking for large or specialized datasets
|
| 24 |
+
- Emulates real-world usage scenarios by creating fresh tasks that guard against memorized knowledge
|
| 25 |
+
- Out-of-the-box pipeline stages, plus an easy plugin mechanism to accommodate custom models or domain constraints
|
| 26 |
+
|
| 27 |
+
[๐ Github Page](https://github.com/huggingface/yourbench/tree/v0.2-alpha-space)
|
| 28 |
+
"""
|
| 29 |
+
|
| 30 |
UPLOAD_DIRECTORY.mkdir(parents=True, exist_ok=True)
|
| 31 |
|
| 32 |
logger.remove()
|
|
|
|
| 35 |
command = ["uv", "run", "yourbench", f"--config={CONFIG_PATH}"]
|
| 36 |
manager = SubprocessManager(command)
|
| 37 |
|
| 38 |
+
# Create a citation section
|
| 39 |
+
docs_path = Path(__file__).parent / "docs.md"
|
| 40 |
+
|
| 41 |
+
# Read the file safely
|
| 42 |
+
if docs_path.exists():
|
| 43 |
+
docs_content = docs_path.read_text()
|
| 44 |
+
else:
|
| 45 |
+
docs_content = "# Citation\n\nDocumentation file not found."
|
| 46 |
+
|
| 47 |
+
citation_content = docs_content.split("# Citation")[-1].strip()
|
| 48 |
+
|
| 49 |
def generate_and_return(hf_org, hf_prefix):
|
| 50 |
"""Handles config generation and validates file existence before enabling download"""
|
| 51 |
+
generate_and_save_config(hf_org, hf_prefix)
|
| 52 |
|
| 53 |
# Wait until the config file is actually created
|
| 54 |
for _ in range(5):
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
with gr.Blocks() as app:
|
| 95 |
+
gr.Markdown(project_description)
|
| 96 |
+
|
| 97 |
gr.Markdown("## YourBench Setup")
|
| 98 |
|
| 99 |
with gr.Row():
|
|
|
|
| 144 |
kill_button = gr.Button("Kill Task")
|
| 145 |
kill_button.click(manager.kill_process)
|
| 146 |
|
| 147 |
+
# Citation section at the end
|
| 148 |
+
with gr.Accordion("๐ Citation", open=False):
|
| 149 |
+
gr.Markdown(citation_content)
|
| 150 |
+
|
| 151 |
+
|
| 152 |
app.launch(allowed_paths=["/app"])
|
yourbench_space/docs.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Citation
|
| 2 |
+
|
| 3 |
+
If you use YourBench in your work, please cite:
|
| 4 |
+
|
| 5 |
+
```bibtex
|
| 6 |
+
@misc{yourbench,
|
| 7 |
+
author = { },
|
| 8 |
+
title = {YourBench: A Dynamic Benchmark Generation Framework},
|
| 9 |
+
year = {2025},
|
| 10 |
+
}
|