Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,7 +91,7 @@ def _normalize_folder_id(raw_id: str) -> Optional[str]:
|
|
| 91 |
raw = m.group(1)
|
| 92 |
# drop query string
|
| 93 |
raw = raw.split("?")[0]
|
| 94 |
-
#
|
| 95 |
raw = raw.rstrip(" .。;;,,』」)」)】]}")
|
| 96 |
# validate
|
| 97 |
return raw if re.fullmatch(r"[A-Za-z0-9_-]{20,}", raw) else None
|
|
@@ -304,4 +304,19 @@ with gr.Blocks(title="Map → Google Drive Uploader") as demo:
|
|
| 304 |
list_btn = gr.Button("📄 列出資料夾內容")
|
| 305 |
|
| 306 |
with gr.Column():
|
| 307 |
-
out_image =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
raw = m.group(1)
|
| 92 |
# drop query string
|
| 93 |
raw = raw.split("?")[0]
|
| 94 |
+
# trim common trailing punctuation / full-width chars
|
| 95 |
raw = raw.rstrip(" .。;;,,』」)」)】]}")
|
| 96 |
# validate
|
| 97 |
return raw if re.fullmatch(r"[A-Za-z0-9_-]{20,}", raw) else None
|
|
|
|
| 304 |
list_btn = gr.Button("📄 列出資料夾內容")
|
| 305 |
|
| 306 |
with gr.Column():
|
| 307 |
+
out_image = gr.Image(label="Preview", type="filepath")
|
| 308 |
+
out_msg = gr.Markdown(label="Result / Link")
|
| 309 |
+
cfg_out = gr.Markdown(label="Debug")
|
| 310 |
+
list_out = gr.Markdown(label="Folder Listing")
|
| 311 |
+
|
| 312 |
+
run_btn.click(
|
| 313 |
+
fn=generate_and_upload,
|
| 314 |
+
inputs=[points_in, title_in, min_lon_in, max_lon_in, min_lat_in, max_lat_in,
|
| 315 |
+
folder_id_in, make_public_in],
|
| 316 |
+
outputs=[out_image, out_msg],
|
| 317 |
+
)
|
| 318 |
+
cfg_btn.click(fn=check_config, inputs=None, outputs=cfg_out)
|
| 319 |
+
list_btn.click(fn=list_folder_contents, inputs=folder_id_in, outputs=list_out)
|
| 320 |
+
|
| 321 |
+
if __name__ == "__main__":
|
| 322 |
+
demo.launch()
|