Update app.py
Browse files
app.py
CHANGED
@@ -3,10 +3,10 @@ import gradio as gr
|
|
3 |
from PIL import Image
|
4 |
import os
|
5 |
|
6 |
-
def show(
|
7 |
-
# Convert SVG to PNG
|
8 |
output_path = "./test.png"
|
9 |
-
cairosvg.svg2png(
|
10 |
|
11 |
# Open and return the PNG image
|
12 |
png_image = Image.open(output_path)
|
@@ -17,7 +17,7 @@ with gr.Blocks() as bl:
|
|
17 |
|
18 |
with gr.Row():
|
19 |
with gr.Column():
|
20 |
-
svg_input = gr.
|
21 |
convert_btn = gr.Button("Convert")
|
22 |
|
23 |
with gr.Column():
|
|
|
3 |
from PIL import Image
|
4 |
import os
|
5 |
|
6 |
+
def show(svg_file):
|
7 |
+
# Convert uploaded SVG file to PNG
|
8 |
output_path = "./test.png"
|
9 |
+
cairosvg.svg2png(file_obj=svg_file, write_to=output_path)
|
10 |
|
11 |
# Open and return the PNG image
|
12 |
png_image = Image.open(output_path)
|
|
|
17 |
|
18 |
with gr.Row():
|
19 |
with gr.Column():
|
20 |
+
svg_input = gr.File(label="Upload SVG File", file_types=[".svg"])
|
21 |
convert_btn = gr.Button("Convert")
|
22 |
|
23 |
with gr.Column():
|