Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,9 +37,10 @@ def convert_image_to_dxf(image_file, output_folder=None):
|
|
37 |
if not os.path.exists(output_path):
|
38 |
return "Conversion failed: DXF file was not created.", None, None
|
39 |
|
40 |
-
# Prepare folder structure for upload
|
41 |
date_folder = f"{current_date}"
|
42 |
|
|
|
43 |
hf_token = os.getenv("HF_TOKEN")
|
44 |
if not hf_token:
|
45 |
return "Hugging Face token not found", None, None
|
@@ -74,11 +75,8 @@ def convert_image_to_dxf(image_file, output_folder=None):
|
|
74 |
)
|
75 |
uploaded_files.append(uploaded_debug)
|
76 |
|
77 |
-
# Generate download links for each uploaded file (optional)
|
78 |
-
links = [f"https://huggingface.co/{uploaded_file.repo_url}/blob/main/{uploaded_file.path_in_repo}" for uploaded_file in uploaded_files]
|
79 |
-
|
80 |
# Return files directly for download in Gradio interface
|
81 |
-
return output_path, debug_output_path,
|
82 |
|
83 |
except subprocess.CalledProcessError as e:
|
84 |
error_msg = f"Error converting image to DXF: {e.stderr.decode('utf-8') if e.stderr else e}"
|
|
|
37 |
if not os.path.exists(output_path):
|
38 |
return "Conversion failed: DXF file was not created.", None, None
|
39 |
|
40 |
+
# Prepare folder structure for upload
|
41 |
date_folder = f"{current_date}"
|
42 |
|
43 |
+
# Hugging Face token
|
44 |
hf_token = os.getenv("HF_TOKEN")
|
45 |
if not hf_token:
|
46 |
return "Hugging Face token not found", None, None
|
|
|
75 |
)
|
76 |
uploaded_files.append(uploaded_debug)
|
77 |
|
|
|
|
|
|
|
78 |
# Return files directly for download in Gradio interface
|
79 |
+
return output_path, debug_output_path, uploaded_files
|
80 |
|
81 |
except subprocess.CalledProcessError as e:
|
82 |
error_msg = f"Error converting image to DXF: {e.stderr.decode('utf-8') if e.stderr else e}"
|