Spaces:
Runtime error
Runtime error
Commit
·
d5b1786
1
Parent(s):
75e0092
remove debug and use hf_api for login
Browse files
app.py
CHANGED
@@ -60,19 +60,17 @@ def process_pdfs(pdf_files, sample_size, hf_repo, oauth_token: gr.OAuthToken | N
|
|
60 |
images, message = pdf_to_images(pdf_files, sample_size, images_dir)
|
61 |
|
62 |
if hf_repo:
|
63 |
-
print(oauth_token.token)
|
64 |
try:
|
65 |
-
|
|
|
66 |
hf_repo,
|
67 |
repo_type="dataset",
|
68 |
-
token=oauth_token.token,
|
69 |
)
|
70 |
-
upload_folder(
|
71 |
folder_path=images_dir,
|
72 |
repo_id=hf_repo,
|
73 |
repo_type="dataset",
|
74 |
path_in_repo="images",
|
75 |
-
token=oauth_token.token,
|
76 |
)
|
77 |
message += (
|
78 |
f"\nUploaded images to Hugging Face repo: {hf_repo}/images"
|
|
|
60 |
images, message = pdf_to_images(pdf_files, sample_size, images_dir)
|
61 |
|
62 |
if hf_repo:
|
|
|
63 |
try:
|
64 |
+
hf_api = HfApi(token=oauth_token.token)
|
65 |
+
hf_api.create_repo(
|
66 |
hf_repo,
|
67 |
repo_type="dataset",
|
|
|
68 |
)
|
69 |
+
hf_api.upload_folder(
|
70 |
folder_path=images_dir,
|
71 |
repo_id=hf_repo,
|
72 |
repo_type="dataset",
|
73 |
path_in_repo="images",
|
|
|
74 |
)
|
75 |
message += (
|
76 |
f"\nUploaded images to Hugging Face repo: {hf_repo}/images"
|