Spaces:
Sleeping
Sleeping
File size: 759 Bytes
6fa035b e6306f4 6fa035b f4c39f1 69f3076 6fa035b f4c39f1 69f3076 f4c39f1 6fa035b f4c39f1 6fa035b 0ba68c7 |
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 |
from processing import process_spaces
from apscheduler.schedulers.background import BackgroundScheduler
from fastapi import FastAPI
from fastapi.responses import HTMLResponse
import uvicorn
import datetime
app = FastAPI()
@app.get("/")
def index():
return HTMLResponse(
"""
<p>Backend for gradio theme gallery.
<a href="https://huggingface.co/spaces/freddyaboulton/theme-gallery-static">https://huggingface.co/spaces/freddyaboulton/theme-gallery-stati</a>
</p>"""
)
scheduler = BackgroundScheduler()
scheduler.add_job(
func=process_spaces,
trigger="interval",
seconds=1200,
next_run_time=datetime.datetime.now(),
)
scheduler.start()
if __name__ == "__main__":
uvicorn.run(app, port=7860, host="0.0.0.0")
|