davanstrien HF staff commited on
Commit
cc9c5eb
1 Parent(s): 51484a8

Refactor main.py

Browse files
Files changed (1) hide show
  1. main.py +11 -10
main.py CHANGED
@@ -16,22 +16,22 @@ from starlette.responses import RedirectResponse
16
 
17
  load_dotenv()
18
  logger = logging.getLogger(__name__)
19
- app = FastAPI()
20
  VOTES_FILE = "votes/votes.jsonl"
21
 
22
 
23
  HF_TOKEN = os.getenv("HF_TOKEN")
24
  hf_api = HfApi(token=HF_TOKEN)
25
 
26
- scheduler = CommitScheduler(
27
- repo_id="davanstrien/summary-ratings",
28
- repo_type="dataset",
29
- folder_path="votes",
30
- path_in_repo="data",
31
- every=1,
32
- token=HF_TOKEN,
33
- hf_api=hf_api,
34
- )
35
 
36
 
37
  @asynccontextmanager
@@ -51,6 +51,7 @@ async def lifespan(app: FastAPI):
51
  yield
52
 
53
 
 
54
  # # Configure CORS
55
  # origins = [
56
  # "https://huggingface.co",
 
16
 
17
  load_dotenv()
18
  logger = logging.getLogger(__name__)
19
+
20
  VOTES_FILE = "votes/votes.jsonl"
21
 
22
 
23
  HF_TOKEN = os.getenv("HF_TOKEN")
24
  hf_api = HfApi(token=HF_TOKEN)
25
 
26
+ # scheduler = CommitScheduler(
27
+ # repo_id="davanstrien/summary-ratings",
28
+ # repo_type="dataset",
29
+ # folder_path="votes",
30
+ # path_in_repo="data",
31
+ # every=1,
32
+ # token=HF_TOKEN,
33
+ # hf_api=hf_api,
34
+ # )
35
 
36
 
37
  @asynccontextmanager
 
51
  yield
52
 
53
 
54
+ app = FastAPI(lifespan=lifespan)
55
  # # Configure CORS
56
  # origins = [
57
  # "https://huggingface.co",