File size: 1,819 Bytes
607d357
1d1ad7c
 
 
607d357
 
7b873db
 
 
6cf7311
1d1ad7c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14766ed
1d1ad7c
1d36d38
1d1ad7c
 
d263bdd
7b873db
1d36d38
 
7b873db
607d357
 
1d1ad7c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import gradio as gr
import cpuinfo
import subprocess
import platform
import os





def check_cpu_extensions():
    info = cpuinfo.get_cpu_info()
    flags = info.get('flags', [])

    avx512 = any(f.startswith("avx512") for f in flags)
    vnni = "vnni" in flags or "avx512_vnni" in flags

    # Optional fallback using `lscpu` (on Linux) or `wmic` (on Windows)
    extra = ""
    if platform.system() == "Linux":
        try:
            lscpu = subprocess.check_output("lscpu", shell=True).decode()
            if "avx512" in lscpu.lower():
                avx512 = True
            if "vnni" in lscpu.lower():
                vnni = True
        except Exception as e:
            extra = f"(lscpu error: {e})"

    elif platform.system() == "Windows":
        try:
            output = subprocess.check_output("wmic cpu get caption, name, deviceid, architecture, datawidth", shell=True).decode()
            extra += "\nWMIC Info:\n" + output
        except Exception as e:
            extra += f"(wmic error: {e})"

    summary = f"""
    ✅ AVX512: {"Yes" if avx512 else "No"}
    ✅ VNNI: {"Yes" if vnni else "No"}
    🧠 CPU: {info.get("brand_raw", "Unknown")}
    🧰 Additional Info: {extra.strip() if extra else "Python, OBVIOUSLY isnt your first language, IS it? oh, and BTW, your mother dresses you funny "}
    """
    return summary.strip()

with gr.Blocks() as demo:
    gr.Markdown("## 🔍 CPU Extension Checker: ")
    output = gr.Textbox(label="Improve your life & reputation with today's", info=" expressed valuation by means of intensely insane leveraging of common sense through advanced state of the fart programming. PUSH the button. we dare you ", lines=6)
    btn = gr.Button("do it")
    btn.click(check_cpu_extensions, outputs=[output])


if __name__ == "__main__":
    demo.launch()