Commit ·
a7abff6
1
Parent(s): d2b84a1
Change to direct dowload
Browse files
app.py
CHANGED
|
@@ -147,12 +147,13 @@ def process_pdf_files(input_pdfs, selected_color_comment_indices, tolerance, cus
|
|
| 147 |
output_dir = "./output"
|
| 148 |
os.makedirs(output_dir, exist_ok=True)
|
| 149 |
|
| 150 |
-
# Create a
|
| 151 |
temp_filename = os.path.join(output_dir, f"CoordinationPDFS_{current_date}.zip")
|
| 152 |
with open(temp_filename, 'wb') as tmp_file:
|
| 153 |
tmp_file.write(zip_in_memory.read())
|
| 154 |
|
| 155 |
-
|
|
|
|
| 156 |
|
| 157 |
# Define the Gradio interface
|
| 158 |
interface = gr.Interface(
|
|
@@ -169,7 +170,7 @@ interface = gr.Interface(
|
|
| 169 |
gr.Textbox(label="Custom Comment", placeholder="Enter custom comment for this color"),
|
| 170 |
gr.Textbox(label="Custom Stroke Color (R,G,B)", placeholder="Enter stroke color in RGB format, e.g., 0,0,255")
|
| 171 |
],
|
| 172 |
-
outputs=
|
| 173 |
title="PDF Color Region Markup"
|
| 174 |
)
|
| 175 |
|
|
|
|
| 147 |
output_dir = "./output"
|
| 148 |
os.makedirs(output_dir, exist_ok=True)
|
| 149 |
|
| 150 |
+
# Create a file in the output directory with a custom name including the date
|
| 151 |
temp_filename = os.path.join(output_dir, f"CoordinationPDFS_{current_date}.zip")
|
| 152 |
with open(temp_filename, 'wb') as tmp_file:
|
| 153 |
tmp_file.write(zip_in_memory.read())
|
| 154 |
|
| 155 |
+
# Return the downloadable file path as a link
|
| 156 |
+
return f'<a href="{temp_filename}" download>Click here to download the ZIP file</a>'
|
| 157 |
|
| 158 |
# Define the Gradio interface
|
| 159 |
interface = gr.Interface(
|
|
|
|
| 170 |
gr.Textbox(label="Custom Comment", placeholder="Enter custom comment for this color"),
|
| 171 |
gr.Textbox(label="Custom Stroke Color (R,G,B)", placeholder="Enter stroke color in RGB format, e.g., 0,0,255")
|
| 172 |
],
|
| 173 |
+
outputs="html", # Return HTML content with a download link
|
| 174 |
title="PDF Color Region Markup"
|
| 175 |
)
|
| 176 |
|