Delete app.py
Browse files
app.py
DELETED
|
@@ -1,33 +0,0 @@
|
|
| 1 |
-
from pathlib import Path
|
| 2 |
-
|
| 3 |
-
import gradio as gr
|
| 4 |
-
import spaces
|
| 5 |
-
from fastapi.responses import FileResponse
|
| 6 |
-
from fastapi.staticfiles import StaticFiles
|
| 7 |
-
|
| 8 |
-
DIST = Path(__file__).resolve().parent / 'dist'
|
| 9 |
-
app = gr.Server()
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
@app.api(name='gpu_check')
|
| 13 |
-
@spaces.GPU(duration=10)
|
| 14 |
-
def gpu_check() -> float:
|
| 15 |
-
"""Run a small calculation on the allocated GPU."""
|
| 16 |
-
import torch
|
| 17 |
-
return (torch.ones(1, device='cuda') + 1).item()
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
@app.get('/api/health')
|
| 21 |
-
def health():
|
| 22 |
-
return {'status': 'ok'}
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
@app.get('/')
|
| 26 |
-
def index():
|
| 27 |
-
return FileResponse(DIST / 'index.html')
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
app.mount('/assets', StaticFiles(directory=DIST / 'assets'), name='assets')
|
| 31 |
-
|
| 32 |
-
if __name__ == '__main__':
|
| 33 |
-
app.launch(server_name='0.0.0.0')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|