Spaces:
Sleeping
Sleeping
Update app.py
Browse files46 unmodified lines474849505152535455565710 unmodified lines68697066717273742 unmodified lines777879758081828346 unmodified linesdef generate_dpr(files): dpr_text = [] current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") # Add header to the PDF dpr_text.append(f"Daily Progress Report\nGenerated on: {current_time}\n") # Process each uploaded file (image) for file in files: # Open the image from file path image = Image.open(file.name) # Using file.name for filepath10 unmodified lines detailed_caption = detect_construction_info(caption) # Generate DPR section for this image dpr_section = f"Date: {current_time}\nImage: {file.name}\n{detailed_caption}\n\n" dpr_section = f"\nImage: {file.name}\n{detailed_caption}\n" dpr_text.append(dpr_section)
# Generate a PDF report2 unmodified lines c.drawString(100, 750, "Daily Progress Report") c.drawString(100, 730, f"Generated on: {current_time}")
# Add the image captions to the PDF # Add the detailed captions for each image to the PDF y_position = 700 for section in dpr_text: c.drawString(100, y_position, section)app.py+7-2