Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from docx import Document
|
| 3 |
-
from docx.shared import Inches, Pt
|
|
|
|
| 4 |
from PIL import Image
|
| 5 |
from datetime import datetime
|
| 6 |
import os
|
|
@@ -24,6 +25,12 @@ def get_image_owner(img_path):
|
|
| 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 |
|
|
@@ -42,7 +49,10 @@ def process_images(images, job_number, job_name, job_address):
|
|
| 42 |
run_job.font.name = "Arial"
|
| 43 |
run_job.font.size = Pt(14)
|
| 44 |
run_job.bold = True
|
| 45 |
-
run_job.font.color.rgb = RGBColor(
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
uploaded_date = datetime.now().strftime("%Y-%m-%d")
|
| 48 |
|
|
@@ -81,7 +91,7 @@ def process_images(images, job_number, job_name, job_address):
|
|
| 81 |
# HTML code to display the logo and title together
|
| 82 |
title_with_logo = """
|
| 83 |
<div style="text-align: center;">
|
| 84 |
-
<img src="
|
| 85 |
<h1>HKC Report Generator</h1>
|
| 86 |
</div>
|
| 87 |
"""
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from docx import Document
|
| 3 |
+
from docx.shared import Inches, Pt
|
| 4 |
+
from docx.oxml import OxmlElement
|
| 5 |
from PIL import Image
|
| 6 |
from datetime import datetime
|
| 7 |
import os
|
|
|
|
| 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 |
|
|
|
|
| 49 |
run_job.font.name = "Arial"
|
| 50 |
run_job.font.size = Pt(14)
|
| 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 |
|
|
|
|
| 91 |
# HTML code to display the logo and title together
|
| 92 |
title_with_logo = """
|
| 93 |
<div style="text-align: center;">
|
| 94 |
+
<img src="https://i.ibb.co/5Lm66yX/ezgif-com-webp-to-gif-converter.gif" alt="Logo" width="100"><br>
|
| 95 |
<h1>HKC Report Generator</h1>
|
| 96 |
</div>
|
| 97 |
"""
|