Spaces:
Paused
Paused
Commit
•
e51c8cf
1
Parent(s):
148a6b2
Add logger info for existing votes file
Browse files
main.py
CHANGED
@@ -35,6 +35,7 @@ HF_TOKEN = os.getenv("HF_TOKEN")
|
|
35 |
|
36 |
hf_api = HfApi(token=HF_TOKEN)
|
37 |
async_httpx_client = AsyncClient()
|
|
|
38 |
scheduler = CommitScheduler(
|
39 |
repo_id="davanstrien/summary-ratings",
|
40 |
repo_type="dataset",
|
@@ -58,26 +59,28 @@ async def lifespan(app: FastAPI):
|
|
58 |
local_dir=".",
|
59 |
local_dir_use_symlinks=False,
|
60 |
)
|
61 |
-
|
|
|
|
|
62 |
yield
|
63 |
|
64 |
|
65 |
app = FastAPI(lifespan=lifespan)
|
66 |
# Configure CORS
|
67 |
-
origins = [
|
68 |
-
|
69 |
-
|
70 |
-
]
|
71 |
-
|
72 |
-
|
73 |
-
# Configure CORS settings
|
74 |
-
app.add_middleware(
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
)
|
81 |
|
82 |
|
83 |
def save_vote(vote_entry):
|
|
|
35 |
|
36 |
hf_api = HfApi(token=HF_TOKEN)
|
37 |
async_httpx_client = AsyncClient()
|
38 |
+
|
39 |
scheduler = CommitScheduler(
|
40 |
repo_id="davanstrien/summary-ratings",
|
41 |
repo_type="dataset",
|
|
|
59 |
local_dir=".",
|
60 |
local_dir_use_symlinks=False,
|
61 |
)
|
62 |
+
logger.info(f"Downloaded votes.jsonl to {path}")
|
63 |
+
else:
|
64 |
+
logger.info("Votes file already exists")
|
65 |
yield
|
66 |
|
67 |
|
68 |
app = FastAPI(lifespan=lifespan)
|
69 |
# Configure CORS
|
70 |
+
# origins = [
|
71 |
+
# "https://huggingface.co/*",
|
72 |
+
# # "chrome-extension://deckahggoiaphiebdipfbiinmaihfpbk", # Replace with your Chrome plugin ID
|
73 |
+
# ]
|
74 |
+
|
75 |
+
|
76 |
+
# # Configure CORS settings
|
77 |
+
# app.add_middleware(
|
78 |
+
# CORSMiddleware,
|
79 |
+
# allow_origins=["https://huggingface.co/*"], # Update with your frontend URL
|
80 |
+
# allow_credentials=True,
|
81 |
+
# allow_methods=["*"],
|
82 |
+
# allow_headers=["*"],
|
83 |
+
# )
|
84 |
|
85 |
|
86 |
def save_vote(vote_entry):
|