github-actions[bot]
commited on
Commit
·
580efab
1
Parent(s):
5034e0d
Sync from GitHub: dfca4321b2442a0f476dbb6b340c99f0c7833d06
Browse files
main.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
from fastapi import FastAPI, UploadFile, File, BackgroundTasks, HTTPException
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from fastapi.staticfiles import StaticFiles
|
|
|
|
| 4 |
import shutil
|
| 5 |
import os
|
| 6 |
import uuid
|
|
@@ -11,6 +12,24 @@ from services.beat_tracker import BeatTracker
|
|
| 11 |
|
| 12 |
app = FastAPI(title="Tunebase AI Engine", description="High-performance audio separation for Math Rock", version="1.0.0")
|
| 13 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
# Setup CORS
|
| 15 |
origins = ["*"] # Allow all for dev
|
| 16 |
app.add_middleware(
|
|
@@ -70,10 +89,6 @@ import time
|
|
| 70 |
import shutil
|
| 71 |
|
| 72 |
def cleanup_old_files():
|
| 73 |
-
"""
|
| 74 |
-
Menghapus file di folder PROCESSED_DIR yang lebih tua dari 1 jam
|
| 75 |
-
untuk menghemat disk space di Hugging Face Spaces.
|
| 76 |
-
"""
|
| 77 |
print("Running cleanup task...")
|
| 78 |
now = time.time()
|
| 79 |
cutoff = now - 3600 # 1 hour (3600 seconds)
|
|
|
|
| 1 |
from fastapi import FastAPI, UploadFile, File, BackgroundTasks, HTTPException
|
| 2 |
from fastapi.middleware.cors import CORSMiddleware
|
| 3 |
from fastapi.staticfiles import StaticFiles
|
| 4 |
+
from fastapi.responses import HTMLResponse
|
| 5 |
import shutil
|
| 6 |
import os
|
| 7 |
import uuid
|
|
|
|
| 12 |
|
| 13 |
app = FastAPI(title="Tunebase AI Engine", description="High-performance audio separation for Math Rock", version="1.0.0")
|
| 14 |
|
| 15 |
+
@app.get("/", response_class=HTMLResponse)
|
| 16 |
+
async def read_root():
|
| 17 |
+
return """
|
| 18 |
+
<!DOCTYPE html>
|
| 19 |
+
<html>
|
| 20 |
+
<head>
|
| 21 |
+
<title>Tunebase</title>
|
| 22 |
+
<style>
|
| 23 |
+
body, html { margin: 0; padding: 0; height: 100%; overflow: hidden; }
|
| 24 |
+
iframe { width: 100%; height: 100%; border: none; }
|
| 25 |
+
</style>
|
| 26 |
+
</head>
|
| 27 |
+
<body>
|
| 28 |
+
<iframe src="https://tunebase.vercel.app" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
| 29 |
+
</body>
|
| 30 |
+
</html>
|
| 31 |
+
"""
|
| 32 |
+
|
| 33 |
# Setup CORS
|
| 34 |
origins = ["*"] # Allow all for dev
|
| 35 |
app.add_middleware(
|
|
|
|
| 89 |
import shutil
|
| 90 |
|
| 91 |
def cleanup_old_files():
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
print("Running cleanup task...")
|
| 93 |
now = time.time()
|
| 94 |
cutoff = now - 3600 # 1 hour (3600 seconds)
|