Spaces:
Runtime error
Runtime error
update
Browse files
app.py
CHANGED
|
@@ -186,24 +186,63 @@ def process_ui(folder_id, naming_convention):
|
|
| 186 |
for file in renamed_files] if renamed_files else []
|
| 187 |
return status, table_data
|
| 188 |
|
| 189 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 190 |
demo = gr.Interface(
|
| 191 |
fn=process_ui,
|
| 192 |
inputs=[
|
| 193 |
gr.Textbox(
|
| 194 |
label="Google Drive Folder ID",
|
| 195 |
-
placeholder="Enter the folder ID from the URL"
|
|
|
|
| 196 |
),
|
| 197 |
gr.Textbox(
|
| 198 |
label="Naming Convention",
|
| 199 |
placeholder="e.g., sports_card",
|
| 200 |
-
value="sports_card"
|
|
|
|
| 201 |
)
|
| 202 |
],
|
| 203 |
outputs=[
|
| 204 |
-
gr.Textbox(
|
|
|
|
|
|
|
|
|
|
| 205 |
gr.Dataframe(
|
| 206 |
-
headers=["Original Name", "New Name", "File Path"]
|
|
|
|
| 207 |
)
|
| 208 |
],
|
| 209 |
title="Sports Cards Dataset Processor",
|
|
@@ -214,7 +253,9 @@ demo = gr.Interface(
|
|
| 214 |
3. Click submit to start processing
|
| 215 |
|
| 216 |
Note: Only image files will be processed. Invalid images will be skipped.
|
| 217 |
-
"""
|
|
|
|
|
|
|
| 218 |
)
|
| 219 |
|
| 220 |
if __name__ == "__main__":
|
|
|
|
| 186 |
for file in renamed_files] if renamed_files else []
|
| 187 |
return status, table_data
|
| 188 |
|
| 189 |
+
# Custom CSS for web-safe fonts and improved styling
|
| 190 |
+
custom_css = """
|
| 191 |
+
div.gradio-container {
|
| 192 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
|
| 193 |
+
}
|
| 194 |
+
div.gradio-container button {
|
| 195 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
|
| 196 |
+
}
|
| 197 |
+
div.gradio-container input {
|
| 198 |
+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
|
| 199 |
+
}
|
| 200 |
+
.gr-form {
|
| 201 |
+
background-color: #ffffff;
|
| 202 |
+
border-radius: 8px;
|
| 203 |
+
padding: 20px;
|
| 204 |
+
box-shadow: 0 1px 3px rgba(0,0,0,0.1);
|
| 205 |
+
}
|
| 206 |
+
.gr-button {
|
| 207 |
+
background-color: #2c5282;
|
| 208 |
+
color: white;
|
| 209 |
+
}
|
| 210 |
+
.gr-button:hover {
|
| 211 |
+
background-color: #2b6cb0;
|
| 212 |
+
}
|
| 213 |
+
.gr-input {
|
| 214 |
+
border: 1px solid #e2e8f0;
|
| 215 |
+
}
|
| 216 |
+
.gr-input:focus {
|
| 217 |
+
border-color: #4299e1;
|
| 218 |
+
box-shadow: 0 0 0 1px #4299e1;
|
| 219 |
+
}
|
| 220 |
+
"""
|
| 221 |
+
|
| 222 |
+
# Gradio interface
|
| 223 |
demo = gr.Interface(
|
| 224 |
fn=process_ui,
|
| 225 |
inputs=[
|
| 226 |
gr.Textbox(
|
| 227 |
label="Google Drive Folder ID",
|
| 228 |
+
placeholder="Enter the folder ID from the URL",
|
| 229 |
+
info="Found in your Google Drive folder's URL"
|
| 230 |
),
|
| 231 |
gr.Textbox(
|
| 232 |
label="Naming Convention",
|
| 233 |
placeholder="e.g., sports_card",
|
| 234 |
+
value="sports_card",
|
| 235 |
+
info="Use only letters, numbers, and underscores"
|
| 236 |
)
|
| 237 |
],
|
| 238 |
outputs=[
|
| 239 |
+
gr.Textbox(
|
| 240 |
+
label="Status",
|
| 241 |
+
lines=3
|
| 242 |
+
),
|
| 243 |
gr.Dataframe(
|
| 244 |
+
headers=["Original Name", "New Name", "File Path"],
|
| 245 |
+
wrap=True
|
| 246 |
)
|
| 247 |
],
|
| 248 |
title="Sports Cards Dataset Processor",
|
|
|
|
| 253 |
3. Click submit to start processing
|
| 254 |
|
| 255 |
Note: Only image files will be processed. Invalid images will be skipped.
|
| 256 |
+
""",
|
| 257 |
+
css=custom_css,
|
| 258 |
+
theme="default"
|
| 259 |
)
|
| 260 |
|
| 261 |
if __name__ == "__main__":
|