dpredrag commited on
Commit
7f48a08
1 Parent(s): e4724c0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -15,12 +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.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,9 +224,8 @@ async def sync_data():
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,11 +315,7 @@ def get_page(page: int = 1, sort: Sort = Sort.trending, style: Style = Style.all
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")
 
15
  from huggingface_hub import Repository
16
  from PIL import Image, ImageOps
17
  from fastapi import FastAPI, BackgroundTasks
18
+
19
 
20
  from fastapi_utils.tasks import repeat_every
21
  from fastapi.middleware.cors import CORSMiddleware
22
  import boto3
23
+ 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
+ subprocess.Popen(
228
+ f"git add . && git commit --amend -m 'update at {time}' && git push --force", cwd=DB_FOLDER, shell=True)
 
229
 
230
 
231
  app = FastAPI()
 
315
 
316
  @app.get("/")
317
  def read_root():
318
+ return "Just a bot to sync data from diffusers gallery"
 
 
 
 
319
 
320
 
321
  @app.on_event("startup")