Spaces:
Running
Running
Commit
·
108916e
1
Parent(s):
629886b
fix login
Browse files
app.py
CHANGED
|
@@ -122,14 +122,14 @@ def process_pdfs(
|
|
| 122 |
),
|
| 123 |
)
|
| 124 |
|
| 125 |
-
if oauth_token is None:
|
| 126 |
-
|
| 127 |
-
|
| 128 |
-
|
| 129 |
-
|
| 130 |
-
|
| 131 |
-
|
| 132 |
-
|
| 133 |
|
| 134 |
try:
|
| 135 |
temp_dir = tempfile.mkdtemp()
|
|
@@ -167,6 +167,10 @@ def process_pdfs(
|
|
| 167 |
message += f"\nCreated zip file with {len(images)} images"
|
| 168 |
|
| 169 |
if hf_repo:
|
|
|
|
|
|
|
|
|
|
|
|
|
| 170 |
try:
|
| 171 |
hf_api = HfApi(token=oauth_token.token)
|
| 172 |
hf_api.create_repo(
|
|
|
|
| 122 |
),
|
| 123 |
)
|
| 124 |
|
| 125 |
+
# if oauth_token is None:
|
| 126 |
+
# return (
|
| 127 |
+
# None,
|
| 128 |
+
# None,
|
| 129 |
+
# gr.Markdown(
|
| 130 |
+
# "⚠️ Not logged in to Hugging Face. Please log in to upload to a Hugging Face dataset."
|
| 131 |
+
# ),
|
| 132 |
+
# )
|
| 133 |
|
| 134 |
try:
|
| 135 |
temp_dir = tempfile.mkdtemp()
|
|
|
|
| 167 |
message += f"\nCreated zip file with {len(images)} images"
|
| 168 |
|
| 169 |
if hf_repo:
|
| 170 |
+
if oauth_token is None:
|
| 171 |
+
raise gr.Error(
|
| 172 |
+
"Not logged in to Hugging Face. Please log in to upload to a Hugging Face dataset."
|
| 173 |
+
)
|
| 174 |
try:
|
| 175 |
hf_api = HfApi(token=oauth_token.token)
|
| 176 |
hf_api.create_repo(
|