Update app.py
Browse files
app.py
CHANGED
@@ -42,4 +42,25 @@ def show(svg_file):
|
|
42 |
|
43 |
# Load the PNG as a PIL image
|
44 |
png_image = Image.open(output_path)
|
45 |
-
return png_image, output_path
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
# Load the PNG as a PIL image
|
44 |
png_image = Image.open(output_path)
|
45 |
+
return png_image, output_path
|
46 |
+
|
47 |
+
with gr.Blocks() as bl:
|
48 |
+
gr.Markdown("# SVG to PNG Converter")
|
49 |
+
|
50 |
+
with gr.Row():
|
51 |
+
with gr.Column():
|
52 |
+
svg_input = gr.File(label="Upload SVG File", file_types=[".svg"])
|
53 |
+
convert_btn = gr.Button("Convert")
|
54 |
+
|
55 |
+
with gr.Column():
|
56 |
+
png_output = gr.Image(type='pil', label="Converted PNG")
|
57 |
+
download_btn = gr.File(label="Download PNG")
|
58 |
+
|
59 |
+
# Connect the conversion function
|
60 |
+
convert_btn.click(
|
61 |
+
fn=show,
|
62 |
+
inputs=svg_input,
|
63 |
+
outputs=[png_output, download_btn]
|
64 |
+
)
|
65 |
+
|
66 |
+
bl.launch()
|