Spaces:
Sleeping
Sleeping
File size: 1,532 Bytes
b7b3054 77d45ab 3da9bad b7b3054 3da9bad 77d45ab b7b3054 5792bd1 b7b3054 3da9bad |
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 |
import gradio as gr
import platform
import psutil
import torch
import subprocess
import sys
def get_system_info():
os_info = platform.platform()
cpu_info = platform.processor()
memory = psutil.virtual_memory().total / (1024 ** 3) # Convert to GB
storage = psutil.disk_usage('/').total / (1024 ** 3) # Convert to GB
cuda_version = torch.version.cuda if torch.cuda.is_available() else "Not available"
try:
nvidia_driver = subprocess.check_output(['nvidia-smi', '--query-gpu=driver_version', '--format=csv,noheader']).decode('utf-8').strip()
except:
nvidia_driver = "Not available"
python_version = sys.version
try:
gcc_version = subprocess.check_output(['gcc', '--version']).decode('utf-8').split('\n')[0]
except:
gcc_version = "Not available"
try:
pip_list = subprocess.check_output([sys.executable, '-m', 'pip', 'list', '--format=freeze']).decode('utf-8')
except:
pip_list = "Unable to retrieve pip list"
return f"""
Operating System: {os_info}
CPU: {cpu_info}
Memory: {memory:.2f} GB
Storage: {storage:.2f} GB
CUDA Version: {cuda_version}
NVIDIA Driver Version: {nvidia_driver}
Python Version: {python_version}
GCC Version: {gcc_version}
Installed Python Packages:
{pip_list}
"""
def greet(name):
system_info = get_system_info()
return f"Hello {name}!!\n\nSystem Information:\n{system_info}"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
demo.launch()
|