persadian's picture
Update app.py
5b1c8cd verified
Raw
History Blame Contribute Delete
1.4 kB
# FILE: app.py
# TYPE: Main Gradio Application (Entry Point)
import gradio as gr
from validator import validate_dfqs
from benchmarks import run_benchmarks
from registry import save_model, list_models
def evaluate_model(name, architecture, size, runtime, cpu_flag):
model_info = {
"name": name,
"architecture": architecture,
"size_gb": float(size),
"runtime": runtime,
"cpu_feasible": cpu_flag
}
validation = validate_dfqs(model_info)
benchmarks = run_benchmarks(name)
result = {
"model": model_info,
"validation": validation,
"benchmarks": benchmarks
}
if validation["compliant"]:
save_model(result)
return result
with gr.Blocks(title="DFQS v1.0 Standard Engine") as app:
gr.Markdown("# DFQS Standard Engine")
with gr.Tab("Validator"):
name = gr.Textbox(label="Model Name")
arch = gr.Textbox(label="Architecture")
size = gr.Number(label="Size (GB)")
runtime = gr.Dropdown(["llama.cpp", "gguf", "other"])
cpu = gr.Checkbox(label="CPU Feasible")
btn = gr.Button("Evaluate DFQS Compliance")
out = gr.JSON()
btn.click(
evaluate_model,
inputs=[name, arch, size, runtime, cpu],
outputs=out
)
with gr.Tab("Registry"):
gr.JSON(list_models())
app.launch()