Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
better message
Browse files
app.py
CHANGED
@@ -15,10 +15,12 @@ from pathlib import Path
|
|
15 |
from huggingface_hub import Repository
|
16 |
from PIL import Image, ImageOps
|
17 |
from fastapi import FastAPI, BackgroundTasks
|
|
|
|
|
18 |
from fastapi_utils.tasks import repeat_every
|
19 |
from fastapi.middleware.cors import CORSMiddleware
|
20 |
import boto3
|
21 |
-
import datetime
|
22 |
from db import Database
|
23 |
|
24 |
AWS_ACCESS_KEY_ID = os.getenv('MY_AWS_ACCESS_KEY_ID')
|
@@ -222,8 +224,9 @@ async def sync_data():
|
|
222 |
|
223 |
print("Updating DB repository")
|
224 |
time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
225 |
-
|
226 |
-
|
|
|
227 |
|
228 |
|
229 |
app = FastAPI()
|
@@ -313,7 +316,11 @@ def get_page(page: int = 1, sort: Sort = Sort.trending, style: Style = Style.all
|
|
313 |
|
314 |
@app.get("/")
|
315 |
def read_root():
|
316 |
-
return
|
|
|
|
|
|
|
|
|
317 |
|
318 |
|
319 |
@app.on_event("startup")
|
|
|
15 |
from huggingface_hub import Repository
|
16 |
from PIL import Image, ImageOps
|
17 |
from fastapi import FastAPI, BackgroundTasks
|
18 |
+
from fastapi.responses import HTMLResponse
|
19 |
+
|
20 |
from fastapi_utils.tasks import repeat_every
|
21 |
from fastapi.middleware.cors import CORSMiddleware
|
22 |
import boto3
|
23 |
+
from datetime import datetime
|
24 |
from db import Database
|
25 |
|
26 |
AWS_ACCESS_KEY_ID = os.getenv('MY_AWS_ACCESS_KEY_ID')
|
|
|
224 |
|
225 |
print("Updating DB repository")
|
226 |
time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
227 |
+
cmd = f"git add . && git commit --amend -m 'update at {time}' && git push --force"
|
228 |
+
print(cmd)
|
229 |
+
subprocess.Popen(cmd, cwd=DB_FOLDER, shell=True)
|
230 |
|
231 |
|
232 |
app = FastAPI()
|
|
|
316 |
|
317 |
@app.get("/")
|
318 |
def read_root():
|
319 |
+
# return html page from string
|
320 |
+
return HTMLResponse("""
|
321 |
+
<p>Just a bot to sync data from diffusers gallery please go to
|
322 |
+
<a href="https://huggingface.co/spaces/huggingface-projects/diffusers-gallery">https://huggingface.co/spaces/huggingface-projects/diffusers-gallery</a>
|
323 |
+
</p>""")
|
324 |
|
325 |
|
326 |
@app.on_event("startup")
|