Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -106,16 +106,19 @@ def generate_dpr(files):
|
|
| 106 |
# Save DPR text to PDF
|
| 107 |
pdf_result = save_dpr_to_pdf(dpr_output, pdf_filename)
|
| 108 |
|
| 109 |
-
# Return the DPR text and PDF
|
| 110 |
-
return f"
|
| 111 |
|
| 112 |
-
# Gradio interface for uploading multiple files
|
| 113 |
iface = gr.Interface(
|
| 114 |
fn=generate_dpr,
|
| 115 |
inputs=gr.Files(type="filepath", label="Upload Site Photos"), # Handle batch upload of images
|
| 116 |
-
outputs=
|
|
|
|
|
|
|
|
|
|
| 117 |
title="Daily Progress Report Generator",
|
| 118 |
-
description="Upload up to 10 site photos. The AI model will dynamically detect construction activities, materials, and progress and generate a text-based Daily Progress Report (DPR). The DPR will also be saved as a PDF.",
|
| 119 |
allow_flagging="never" # Optional: Disable flagging
|
| 120 |
)
|
| 121 |
|
|
|
|
| 106 |
# Save DPR text to PDF
|
| 107 |
pdf_result = save_dpr_to_pdf(dpr_output, pdf_filename)
|
| 108 |
|
| 109 |
+
# Return the DPR text and the PDF file path for download
|
| 110 |
+
return dpr_output + f"\n\n{pdf_result}", pdf_filename
|
| 111 |
|
| 112 |
+
# Gradio interface for uploading multiple files, displaying DPR, and downloading PDF
|
| 113 |
iface = gr.Interface(
|
| 114 |
fn=generate_dpr,
|
| 115 |
inputs=gr.Files(type="filepath", label="Upload Site Photos"), # Handle batch upload of images
|
| 116 |
+
outputs=[
|
| 117 |
+
gr.Textbox(label="Daily Progress Report"), # Display DPR text
|
| 118 |
+
gr.File(label="Download PDF") # Provide PDF download link
|
| 119 |
+
],
|
| 120 |
title="Daily Progress Report Generator",
|
| 121 |
+
description="Upload up to 10 site photos. The AI model will dynamically detect construction activities, materials, and progress and generate a text-based Daily Progress Report (DPR). The DPR will also be saved as a PDF, which you can download.",
|
| 122 |
allow_flagging="never" # Optional: Disable flagging
|
| 123 |
)
|
| 124 |
|