UC1_LastPart / app.py
SathvikGanta's picture
Update app.py
2fb1dc7 verified
raw
history blame contribute delete
968 Bytes
import gradio as gr
from modify_pdf import scale_vector_text
def process_pdf(file, scale_factor, thickness_factor):
if file is None:
return "No file uploaded!"
input_pdf = file.name
output_pdf = "output_scaled.pdf"
try:
scale_vector_text(input_pdf, output_pdf, scale_factor, thickness_factor)
return output_pdf
except Exception as e:
return f"Error: {e}"
interface = gr.Interface(
fn=process_pdf,
inputs=[
gr.File(label="Upload PDF", file_types=[".pdf"]),
gr.Slider(1.0, 3.0, step=0.1, value=1.2, label="Size Scaling Factor"),
gr.Slider(1.0, 3.0, step=0.1, value=1.2, label="Thickness Scaling Factor"),
],
outputs=[
gr.File(label="Download Modified PDF")
],
title="Vector Text Transformer",
description="Scale size and thickness of vector-based text in a PDF while preserving layers and vector data."
)
if __name__ == "__main__":
interface.launch()