Spaces:
Sleeping
Sleeping
Download start.ps1 from hsailorj/ymt-python: direct link, hf CLI and curl.
- Browser
- Download file 770 Bytes
-
https://huggingface.co/spaces/hsailorj/ymt-python/resolve/main/start.ps1
- Command line
-
hf download hf://spaces/hsailorj/ymt-python/start.ps1
-
curl -L -o start.ps1 https://huggingface.co/spaces/hsailorj/ymt-python/resolve/main/start.ps1
770 Bytes
| # 后端服务启动脚本 | |
| param( | |
| [int]$Port = 8000 | |
| ) | |
| Write-Host "正在检查端口 $Port 是否被占用..." -ForegroundColor Cyan | |
| # 查找占用端口的进程 | |
| $process = Get-NetTCPConnection -LocalPort $Port -ErrorAction SilentlyContinue | Select-Object -ExpandProperty OwningProcess -First 1 | |
| if ($process) { | |
| Write-Host "端口 $Port 被进程 PID: $process 占用" -ForegroundColor Yellow | |
| Write-Host "正在终止进程..." -ForegroundColor Yellow | |
| Stop-Process -Id $process -Force -ErrorAction SilentlyContinue | |
| Start-Sleep -Seconds 1 | |
| Write-Host "进程已终止" -ForegroundColor Green | |
| } else { | |
| Write-Host "端口 $Port 可用" -ForegroundColor Green | |
| } | |
| Write-Host "`n正在启动后端服务..." -ForegroundColor Cyan | |
| python main.py | |