Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from docx import Document
|
| 3 |
from docx.shared import Inches, Pt, RGBColor
|
| 4 |
-
from docx.oxml import OxmlElement
|
| 5 |
from PIL import Image
|
| 6 |
from datetime import datetime
|
| 7 |
import os
|
|
@@ -25,12 +24,6 @@ def get_image_owner(img_path):
|
|
| 25 |
owner = exif_data.get(315, "") if exif_data else ""
|
| 26 |
return owner
|
| 27 |
|
| 28 |
-
def apply_highlight(paragraph, color="febf60"):
|
| 29 |
-
"""Apply a background color to a paragraph."""
|
| 30 |
-
shading_elm = OxmlElement("w:shd")
|
| 31 |
-
shading_elm.set("w:fill", color) # Hex color for highlight
|
| 32 |
-
paragraph._p.get_or_add("w:r").get_or_add("w:rPr").append(shading_elm)
|
| 33 |
-
|
| 34 |
def process_images(images, job_number, job_name, job_address):
|
| 35 |
logo_path = "logo.png" # Replace with the exact name of your uploaded logo
|
| 36 |
|
|
@@ -51,9 +44,6 @@ def process_images(images, job_number, job_name, job_address):
|
|
| 51 |
run_job.bold = True
|
| 52 |
run_job.font.color.rgb = RGBColor(0, 0, 0) # Set font color to black
|
| 53 |
|
| 54 |
-
# Apply background highlight
|
| 55 |
-
apply_highlight(job_paragraph, color="febf60") # Hex color for highlight
|
| 56 |
-
|
| 57 |
uploaded_date = datetime.now().strftime("%Y-%m-%d")
|
| 58 |
|
| 59 |
# Create a 2x2 table layout for images
|
|
@@ -91,7 +81,7 @@ def process_images(images, job_number, job_name, job_address):
|
|
| 91 |
# HTML code to display the logo and title together
|
| 92 |
title_with_logo = """
|
| 93 |
<div style="text-align: center;">
|
| 94 |
-
<img src="
|
| 95 |
<h1>HKC Report Generator</h1>
|
| 96 |
</div>
|
| 97 |
"""
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from docx import Document
|
| 3 |
from docx.shared import Inches, Pt, RGBColor
|
|
|
|
| 4 |
from PIL import Image
|
| 5 |
from datetime import datetime
|
| 6 |
import os
|
|
|
|
| 24 |
owner = exif_data.get(315, "") if exif_data else ""
|
| 25 |
return owner
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
def process_images(images, job_number, job_name, job_address):
|
| 28 |
logo_path = "logo.png" # Replace with the exact name of your uploaded logo
|
| 29 |
|
|
|
|
| 44 |
run_job.bold = True
|
| 45 |
run_job.font.color.rgb = RGBColor(0, 0, 0) # Set font color to black
|
| 46 |
|
|
|
|
|
|
|
|
|
|
| 47 |
uploaded_date = datetime.now().strftime("%Y-%m-%d")
|
| 48 |
|
| 49 |
# Create a 2x2 table layout for images
|
|
|
|
| 81 |
# HTML code to display the logo and title together
|
| 82 |
title_with_logo = """
|
| 83 |
<div style="text-align: center;">
|
| 84 |
+
<img src="logo.png" alt="Logo" width="100"><br>
|
| 85 |
<h1>HKC Report Generator</h1>
|
| 86 |
</div>
|
| 87 |
"""
|