|
|
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 |
|
|
|
|
|
|
|
|
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() |
|
|
|