Spaces:
Running
Running
Vincentqyw
commited on
Commit
•
8d2e08a
1
Parent(s):
9481e05
add: teaser
Browse files- README.md +2 -0
- app.py +7 -4
- assets/teaser.webp +0 -0
README.md
CHANGED
@@ -8,3 +8,5 @@ sdk_version: 4.26.0
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
|
|
|
|
|
8 |
app_file: app.py
|
9 |
pinned: false
|
10 |
---
|
11 |
+
|
12 |
+
![](assets/teaser.webp)
|
app.py
CHANGED
@@ -97,8 +97,8 @@ def run(server_name: str = "127.0.0.1", server_port: int = 7860):
|
|
97 |
with gr.Blocks() as app:
|
98 |
gr.Markdown(
|
99 |
"""
|
100 |
-
#
|
101 |
-
Upload one or more image files and convert it to
|
102 |
![]('F:/gradio-apps/image_to_webp/caches/1.webp')
|
103 |
"""
|
104 |
)
|
@@ -110,7 +110,7 @@ def run(server_name: str = "127.0.0.1", server_port: int = 7860):
|
|
110 |
file_types=["image"],
|
111 |
)
|
112 |
uploaded_files = gr.Gallery(
|
113 |
-
label="Your images", visible=False, columns=4, height=
|
114 |
)
|
115 |
with gr.Row():
|
116 |
quality_slider = gr.Slider(
|
@@ -134,7 +134,9 @@ def run(server_name: str = "127.0.0.1", server_port: int = 7860):
|
|
134 |
],
|
135 |
value=".webp",
|
136 |
)
|
137 |
-
|
|
|
|
|
138 |
|
139 |
with gr.Column():
|
140 |
output_file = gr.File(label="Converted WebP")
|
@@ -165,6 +167,7 @@ def run(server_name: str = "127.0.0.1", server_port: int = 7860):
|
|
165 |
outputs=[uploaded_files, proc_btn, files],
|
166 |
)
|
167 |
proc_btn.click(process, inputs=inputs, outputs=outputs)
|
|
|
168 |
app.queue().launch(
|
169 |
server_name=server_name, server_port=server_port, share=False
|
170 |
)
|
|
|
97 |
with gr.Blocks() as app:
|
98 |
gr.Markdown(
|
99 |
"""
|
100 |
+
# Image Format Converter
|
101 |
+
Upload one or more image files and convert it to specified format with adjustable quality.
|
102 |
![]('F:/gradio-apps/image_to_webp/caches/1.webp')
|
103 |
"""
|
104 |
)
|
|
|
110 |
file_types=["image"],
|
111 |
)
|
112 |
uploaded_files = gr.Gallery(
|
113 |
+
label="Your images", visible=False, columns=4, height="auto"
|
114 |
)
|
115 |
with gr.Row():
|
116 |
quality_slider = gr.Slider(
|
|
|
134 |
],
|
135 |
value=".webp",
|
136 |
)
|
137 |
+
with gr.Row():
|
138 |
+
proc_btn = gr.Button("Run Convert", variant="primary")
|
139 |
+
reset_btn = gr.Button("Clear Images", variant="secondary")
|
140 |
|
141 |
with gr.Column():
|
142 |
output_file = gr.File(label="Converted WebP")
|
|
|
167 |
outputs=[uploaded_files, proc_btn, files],
|
168 |
)
|
169 |
proc_btn.click(process, inputs=inputs, outputs=outputs)
|
170 |
+
reset_btn.click(lambda: None, None, uploaded_files, queue=False)
|
171 |
app.queue().launch(
|
172 |
server_name=server_name, server_port=server_port, share=False
|
173 |
)
|
assets/teaser.webp
ADDED