Spaces:
Running
Running
andykr1k commited on
Commit ·
acb5ef7
1
Parent(s): ddcf9ed
added fastapi for hf
Browse files- main.py +18 -2
- requirements.txt +3 -1
main.py
CHANGED
|
@@ -7,6 +7,12 @@ import time
|
|
| 7 |
from supabase import create_client
|
| 8 |
from dotenv import load_dotenv
|
| 9 |
import requests
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
load_dotenv()
|
| 12 |
|
|
@@ -330,5 +336,15 @@ def setup_likes_subscription(SUPABASE_ID, SUPABASE_KEY):
|
|
| 330 |
time.sleep(5)
|
| 331 |
|
| 332 |
|
| 333 |
-
|
| 334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
from supabase import create_client
|
| 8 |
from dotenv import load_dotenv
|
| 9 |
import requests
|
| 10 |
+
from fastapi import FastAPI
|
| 11 |
+
import uvicorn
|
| 12 |
+
import threading
|
| 13 |
+
import time
|
| 14 |
+
|
| 15 |
+
app = FastAPI()
|
| 16 |
|
| 17 |
load_dotenv()
|
| 18 |
|
|
|
|
| 336 |
time.sleep(5)
|
| 337 |
|
| 338 |
|
| 339 |
+
@app.get("/")
|
| 340 |
+
def read_root():
|
| 341 |
+
return {"status": "running"}
|
| 342 |
+
|
| 343 |
+
if __name__ == "__main__":
|
| 344 |
+
threading.Thread(
|
| 345 |
+
target=setup_likes_subscription,
|
| 346 |
+
args=(SUPABASE_ID, SUPABASE_KEY),
|
| 347 |
+
daemon=True
|
| 348 |
+
).start()
|
| 349 |
+
|
| 350 |
+
uvicorn.run(app, host="0.0.0.0", port=7860)
|
requirements.txt
CHANGED
|
@@ -23,4 +23,6 @@ supabase==2.5.1
|
|
| 23 |
supafunc==0.4.6
|
| 24 |
typing_extensions==4.12.2
|
| 25 |
websockets==11.0.3
|
| 26 |
-
requests
|
|
|
|
|
|
|
|
|
| 23 |
supafunc==0.4.6
|
| 24 |
typing_extensions==4.12.2
|
| 25 |
websockets==11.0.3
|
| 26 |
+
requests
|
| 27 |
+
fastapi
|
| 28 |
+
uvicorn
|