Spaces:
Sleeping
Sleeping
| from fastapi import FastAPI, HTTPException,WebSocket, File, UploadFile | |
| import os | |
| import multiprocessing | |
| import torch | |
| app = FastAPI() | |
| os.environ['CUDA_LAUNCH_BLOCKING'] = "1" | |
| async def read_root(): | |
| return {"Hello": "World"} | |
| def worker(): | |
| print(f"Worker process started with PID: {os.getpid()}") | |
| print (__name__) | |
| if __name__ == "app": | |
| print("Main process ID:", os.getpid()) | |
| p = multiprocessing.Process(target=worker) | |
| p.start() | |
| p.join() | |
| print("in __main__") | |
| cuda_available = torch.cuda.is_available() | |
| print(f"CUDA Available: {cuda_available}") | |
| if cuda_available: | |
| print(f"Number of CUDA devices: {torch.cuda.device_count()}") | |
| print(f"CUDA Device Name: {torch.cuda.get_device_name(0)}") | |
| else: | |
| print("CUDA is not available. Check your installation.") | |