Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from modify_pdf import
|
| 3 |
|
| 4 |
-
def process_pdf(file, scale_factor):
|
| 5 |
if file is None:
|
| 6 |
return "No file uploaded!"
|
| 7 |
input_pdf = file.name
|
| 8 |
-
output_pdf = "
|
| 9 |
try:
|
| 10 |
-
|
| 11 |
return output_pdf
|
| 12 |
except Exception as e:
|
| 13 |
return f"Error: {e}"
|
|
@@ -16,13 +16,14 @@ interface = gr.Interface(
|
|
| 16 |
fn=process_pdf,
|
| 17 |
inputs=[
|
| 18 |
gr.File(label="Upload PDF", file_types=[".pdf"]),
|
| 19 |
-
gr.Slider(1.0,
|
|
|
|
| 20 |
],
|
| 21 |
outputs=[
|
| 22 |
gr.File(label="Download Modified PDF")
|
| 23 |
],
|
| 24 |
-
title="
|
| 25 |
-
description="
|
| 26 |
)
|
| 27 |
|
| 28 |
if __name__ == "__main__":
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
+
from modify_pdf import scale_vector_text
|
| 3 |
|
| 4 |
+
def process_pdf(file, scale_factor, thickness_factor):
|
| 5 |
if file is None:
|
| 6 |
return "No file uploaded!"
|
| 7 |
input_pdf = file.name
|
| 8 |
+
output_pdf = "output_scaled.pdf"
|
| 9 |
try:
|
| 10 |
+
scale_vector_text(input_pdf, output_pdf, scale_factor, thickness_factor)
|
| 11 |
return output_pdf
|
| 12 |
except Exception as e:
|
| 13 |
return f"Error: {e}"
|
|
|
|
| 16 |
fn=process_pdf,
|
| 17 |
inputs=[
|
| 18 |
gr.File(label="Upload PDF", file_types=[".pdf"]),
|
| 19 |
+
gr.Slider(1.0, 3.0, step=0.1, value=1.2, label="Size Scaling Factor"),
|
| 20 |
+
gr.Slider(1.0, 3.0, step=0.1, value=1.2, label="Thickness Scaling Factor"),
|
| 21 |
],
|
| 22 |
outputs=[
|
| 23 |
gr.File(label="Download Modified PDF")
|
| 24 |
],
|
| 25 |
+
title="Vector Text Transformer",
|
| 26 |
+
description="Scale size and thickness of vector-based text in a PDF while preserving layers and vector data."
|
| 27 |
)
|
| 28 |
|
| 29 |
if __name__ == "__main__":
|