Spaces:
Running
Running
File size: 810 Bytes
f971045 e780314 7431e7c f971045 cfe9046 f971045 6d2d762 |
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 |
import os
os.environ["HF_HOME"] = "/tmp/hf_cache"
os.makedirs("/tmp/hf_cache", exist_ok=True)
from fastapi import FastAPI, Query
from huggingface_hub import list_repo_files, hf_hub_download, upload_file
import io
import requests
from fastapi import BackgroundTasks
from fastapi import FastAPI, UploadFile, File
from fastapi.middleware.cors import CORSMiddleware
import os
import os
import zipfile
import tempfile # ✅ Add this!
app = FastAPI()
# CORS setup to allow requests from your frontend
app.add_middleware(
CORSMiddleware,
allow_origins=["*"], # Replace "*" with your frontend domain in production
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/")
def health_check():
return {"status": "✅ FastAPI running on Hugging Face Spaces!"}
|