Spaces:
Sleeping
Sleeping
Update app.py
Browse files46 unmodified lines47484950515210 unmodified lines636465666768692 unmodified lines7273747576777846 unmodified linesdef generate_dpr(files):dpr_text = []current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")for file in files:# Open the image from file pathimage = Image.open(file.name) # Using file.name for filepath10 unmodified linesdetailed_caption = detect_construction_info(caption)# Generate DPR section for this imagedpr_section = f"Date: {current_time}\nImage: {file.name}\n{detailed_caption}\n\n"dpr_text.append(dpr_section)# Generate a PDF report2 unmodified linesc.drawString(100, 750, "Daily Progress Report")c.drawString(100, 730, f"Generated on: {current_time}")# Add the image captions to the PDFy_position = 700for section in dpr_text:c.drawString(100, y_position, section)46 unmodified lines474849505152535455565710 unmodified lines686970717273742 unmodified lines7778798081828346 unmodified linesdef generate_dpr(files):dpr_text = []current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S")# Add header to the PDFdpr_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 pathimage = Image.open(file.name) # Using file.name for filepath10 unmodified linesdetailed_caption = detect_construction_info(caption)# Generate DPR section for this imagedpr_section = f"\nImage: {file.name}\n{detailed_caption}\n"dpr_text.append(dpr_section)# Generate a PDF report2 unmodified linesc.drawString(100, 750, "Daily Progress Report")c.drawString(100, 730, f"Generated on: {current_time}")# Add the detailed captions for each image to the PDFy_position = 700for section in dpr_text:c.drawString(100, y_position, section)
app.py+7-2