jmullings commited on
Commit ·
8be8a64
1
Parent(s): f957235
Base application
Browse files- app.py +1 -1
- src/submission/submit.py +15 -1
app.py
CHANGED
|
@@ -295,4 +295,4 @@ with demo:
|
|
| 295 |
gr.Textbox(value=CITATION_BUTTON_TEXT, label=CITATION_BUTTON_LABEL, lines=8, show_copy_button=True)
|
| 296 |
|
| 297 |
if __name__ == "__main__":
|
| 298 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
| 295 |
gr.Textbox(value=CITATION_BUTTON_TEXT, label=CITATION_BUTTON_LABEL, lines=8, show_copy_button=True)
|
| 296 |
|
| 297 |
if __name__ == "__main__":
|
| 298 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, ssr=False)
|
src/submission/submit.py
CHANGED
|
@@ -7,6 +7,20 @@ import threading
|
|
| 7 |
import traceback
|
| 8 |
from datetime import datetime, timezone
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Engine import
|
| 11 |
try:
|
| 12 |
from src.audit.engine import AuditError, check_feasibility, run_full_audit
|
|
@@ -99,7 +113,6 @@ def clean_model_name(raw_name: str) -> str:
|
|
| 99 |
|
| 100 |
# Strip HTML tags
|
| 101 |
name = re.sub(r'<[^>]+>', '', name)
|
| 102 |
-
# Strip markdown label brackets [Model Name] -> Model Name
|
| 103 |
name = re.sub(r'\[([^\]]+)\]', r'\1', name)
|
| 104 |
name = name.replace("https://huggingface.co/", "")
|
| 105 |
return name.strip().strip("/")
|
|
@@ -130,6 +143,7 @@ def _save_cert(model_id: str, revision: str, cert: dict) -> str:
|
|
| 130 |
return out_path
|
| 131 |
|
| 132 |
|
|
|
|
| 133 |
def execute_direct_xray_audit(model_id: str, revision: str = "main", trust_remote_code: bool = False, progress_callback=None) -> dict:
|
| 134 |
now_str = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
| 135 |
|
|
|
|
| 7 |
import traceback
|
| 8 |
from datetime import datetime, timezone
|
| 9 |
|
| 10 |
+
# Hugging Face ZeroGPU compatibility
|
| 11 |
+
try:
|
| 12 |
+
import spaces
|
| 13 |
+
has_spaces = True
|
| 14 |
+
except ImportError:
|
| 15 |
+
has_spaces = False
|
| 16 |
+
|
| 17 |
+
def gpu_decorator(duration=120):
|
| 18 |
+
def decorator(fn):
|
| 19 |
+
if has_spaces and hasattr(spaces, "GPU"):
|
| 20 |
+
return spaces.GPU(duration=duration)(fn)
|
| 21 |
+
return fn
|
| 22 |
+
return decorator
|
| 23 |
+
|
| 24 |
# Engine import
|
| 25 |
try:
|
| 26 |
from src.audit.engine import AuditError, check_feasibility, run_full_audit
|
|
|
|
| 113 |
|
| 114 |
# Strip HTML tags
|
| 115 |
name = re.sub(r'<[^>]+>', '', name)
|
|
|
|
| 116 |
name = re.sub(r'\[([^\]]+)\]', r'\1', name)
|
| 117 |
name = name.replace("https://huggingface.co/", "")
|
| 118 |
return name.strip().strip("/")
|
|
|
|
| 143 |
return out_path
|
| 144 |
|
| 145 |
|
| 146 |
+
@gpu_decorator(duration=120)
|
| 147 |
def execute_direct_xray_audit(model_id: str, revision: str = "main", trust_remote_code: bool = False, progress_callback=None) -> dict:
|
| 148 |
now_str = datetime.now(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
|
| 149 |
|