theme-gallery / app.py
freddyaboulton's picture
Take screenshots
f4c39f1
raw
history blame contribute delete
759 Bytes
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")