Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,29 +1,60 @@
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
|
| 3 |
-
from
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
-
with gr.Blocks(title="DFQS v1.0 Standard") as
|
| 10 |
|
| 11 |
-
gr.Markdown("# DFQS
|
| 12 |
-
gr.Markdown("Ultra-Low-Bit MoE Deployment Specification Hub")
|
| 13 |
|
| 14 |
-
with gr.Tab("
|
| 15 |
-
overview_ui()
|
| 16 |
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
|
| 22 |
|
| 23 |
-
|
| 24 |
-
|
|
|
|
|
|
|
|
|
|
| 25 |
|
| 26 |
with gr.Tab("Registry"):
|
| 27 |
-
|
| 28 |
|
| 29 |
-
|
|
|
|
| 1 |
+
# FILE: app.py
|
| 2 |
+
# TYPE: Main Gradio Application (Entry Point)
|
| 3 |
+
|
| 4 |
import gradio as gr
|
| 5 |
|
| 6 |
+
from validator import validate_dfqs
|
| 7 |
+
from benchmarks import run_benchmarks
|
| 8 |
+
from registry import save_model, list_models
|
| 9 |
+
|
| 10 |
+
|
| 11 |
+
def evaluate_model(name, architecture, size, runtime, cpu_flag):
|
| 12 |
+
|
| 13 |
+
model_info = {
|
| 14 |
+
"name": name,
|
| 15 |
+
"architecture": architecture,
|
| 16 |
+
"size_gb": float(size),
|
| 17 |
+
"runtime": runtime,
|
| 18 |
+
"cpu_feasible": cpu_flag
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
validation = validate_dfqs(model_info)
|
| 22 |
+
benchmarks = run_benchmarks(name)
|
| 23 |
+
|
| 24 |
+
result = {
|
| 25 |
+
"model": model_info,
|
| 26 |
+
"validation": validation,
|
| 27 |
+
"benchmarks": benchmarks
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
if validation["compliant"]:
|
| 31 |
+
save_model(result)
|
| 32 |
+
|
| 33 |
+
return result
|
| 34 |
+
|
| 35 |
|
| 36 |
+
with gr.Blocks(title="DFQS v1.0 Standard Engine") as app:
|
| 37 |
|
| 38 |
+
gr.Markdown("# DFQS Standard Engine")
|
|
|
|
| 39 |
|
| 40 |
+
with gr.Tab("Validator"):
|
|
|
|
| 41 |
|
| 42 |
+
name = gr.Textbox(label="Model Name")
|
| 43 |
+
arch = gr.Textbox(label="Architecture")
|
| 44 |
+
size = gr.Number(label="Size (GB)")
|
| 45 |
+
runtime = gr.Dropdown(["llama.cpp", "gguf", "other"])
|
| 46 |
+
cpu = gr.Checkbox(label="CPU Feasible")
|
| 47 |
|
| 48 |
+
btn = gr.Button("Evaluate DFQS Compliance")
|
| 49 |
+
out = gr.JSON()
|
| 50 |
|
| 51 |
+
btn.click(
|
| 52 |
+
evaluate_model,
|
| 53 |
+
inputs=[name, arch, size, runtime, cpu],
|
| 54 |
+
outputs=out
|
| 55 |
+
)
|
| 56 |
|
| 57 |
with gr.Tab("Registry"):
|
| 58 |
+
gr.JSON(list_models())
|
| 59 |
|
| 60 |
+
app.launch()
|