Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,18 +4,13 @@ import os
|
|
| 4 |
|
| 5 |
def upload_file(filepath):
|
| 6 |
"""
|
| 7 |
-
Handle uploaded file and generate its accessible URL
|
| 8 |
-
|
| 9 |
-
in Hugging Face Spaces). Only the first uploaded file path is returned.
|
| 10 |
-
|
| 11 |
Args:
|
| 12 |
filepath: A list of file paths uploaded through the Gradio `File` component.
|
| 13 |
|
| 14 |
Returns:
|
| 15 |
-
|
| 16 |
-
- filepath[0]: The path of the first uploaded file.
|
| 17 |
-
- file_url: A constructed URL pointing to the uploaded file, accessible if hosted on HF Spaces.
|
| 18 |
-
Returns an empty string if `SPACE_HOST` is not set.
|
| 19 |
"""
|
| 20 |
print("----- inside upload file -----")
|
| 21 |
print(f"filepath -- {filepath}")
|
|
|
|
| 4 |
|
| 5 |
def upload_file(filepath):
|
| 6 |
"""
|
| 7 |
+
Handle uploaded file and generate its accessible URL. Function constructs a public-facing URL using the `SPACE_HOST` environment variable.
|
| 8 |
+
|
|
|
|
|
|
|
| 9 |
Args:
|
| 10 |
filepath: A list of file paths uploaded through the Gradio `File` component.
|
| 11 |
|
| 12 |
Returns:
|
| 13 |
+
file_url: An accessible constructed URL pointing to the uploaded file. Use this for downstream processes.
|
|
|
|
|
|
|
|
|
|
| 14 |
"""
|
| 15 |
print("----- inside upload file -----")
|
| 16 |
print(f"filepath -- {filepath}")
|