GuillaumeSalouHF HF staff commited on
Commit
9f779c5
1 Parent(s): 10c1724

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -71
app.py CHANGED
@@ -1,35 +1,4 @@
1
 
2
- Hugging Face's logo Hugging Face
3
-
4
- Models
5
- Datasets
6
- Spaces
7
- Docs
8
- Pricing
9
- Spaces:
10
- huggingface-projects
11
- /
12
- sd-multiplayer-bot
13
- private
14
- App
15
- Files and versions
16
- Community
17
- Settings
18
- sd-multiplayer-bot
19
- / app.py
20
- radames's picture
21
- radames
22
- HF staff
23
- add uuid from files
24
- f6a107f
25
- unverified
26
- about 2 months ago
27
- raw
28
- history
29
- blame
30
- contribute
31
- delete
32
- 3.65 kB
33
  import boto3
34
  import os
35
  import re
@@ -43,51 +12,12 @@ import subprocess
43
  from fastapi import FastAPI
44
  from fastapi_utils.tasks import repeat_every
45
 
46
-
47
- AWS_ACCESS_KEY_ID = os.getenv('AWS_ACCESS_KEY_ID')
48
- AWS_SECRET_KEY = os.getenv('AWS_SECRET_KEY')
49
- AWS_S3_BUCKET_NAME = os.getenv('AWS_S3_BUCKET_NAME')
50
-
51
- s3 = boto3.client(service_name='s3',
52
- aws_access_key_id=AWS_ACCESS_KEY_ID,
53
- aws_secret_access_key=AWS_SECRET_KEY)
54
-
55
-
56
  paginator = s3.get_paginator('list_objects_v2')
57
 
58
-
59
- S3_DATA_FOLDER = Path("sd-multiplayer-data")
60
- ROOMS_DATA_DB = S3_DATA_FOLDER / "rooms_data.db"
61
-
62
-
63
- repo = Repository(
64
- local_dir=S3_DATA_FOLDER,
65
- repo_type="dataset",
66
- clone_from="huggingface-projects/sd-multiplayer-data",
67
- use_auth_token=True,
68
- )
69
  repo.git_pull()
70
 
 
71
 
72
- if not ROOMS_DATA_DB.exists():
73
- print("Creating database")
74
- print("ROOMS_DATA_DB", ROOMS_DATA_DB)
75
- db = sqlite3.connect(ROOMS_DATA_DB)
76
- with open(Path("schema.sql"), "r") as f:
77
- db.executescript(f.read())
78
- db.commit()
79
- db.close()
80
-
81
-
82
- def get_db(db_path):
83
- db = sqlite3.connect(db_path, check_same_thread=False)
84
- db.row_factory = sqlite3.Row
85
- try:
86
- yield db
87
- except Exception:
88
- db.rollback()
89
- finally:
90
- db.close()
91
 
92
 
93
  def sync_rooms_to_dataset():
 
1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  import boto3
3
  import os
4
  import re
 
12
  from fastapi import FastAPI
13
  from fastapi_utils.tasks import repeat_every
14
 
 
 
 
 
 
 
 
 
 
 
15
  paginator = s3.get_paginator('list_objects_v2')
16
 
 
 
 
 
 
 
 
 
 
 
 
17
  repo.git_pull()
18
 
19
+ def get_datasetdata(dataset_path):
20
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
 
23
  def sync_rooms_to_dataset():