Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import gradio as gr
|
2 |
+
from zipfile import ZipFile
|
3 |
+
|
4 |
+
def extract_snapshots(watchface_link):
|
5 |
+
with ZipFile(watchface_link, 'r') as zObject:
|
6 |
+
snapshot = zObject.extract('snapshot.png', path='outputs')
|
7 |
+
bordless_snapshot = zObject.extract('no_borders_snapshot.png', path='outputs')
|
8 |
+
return [snapshot, bordless_snapshot]
|
9 |
+
|
10 |
+
|
11 |
+
with gr.Blocks() as interface:
|
12 |
+
with gr.Column():
|
13 |
+
input_file = gr.File(label="Watchface file", file_count='single', file_types=['watchface'])
|
14 |
+
btn = gr.Button(variant='primary', value="Extract!!")
|
15 |
+
with gr.Row():
|
16 |
+
output_gallery = gr.Gallery(label="Output images")
|
17 |
+
|
18 |
+
btn.click(fn=extract_snapshots, inputs=[input_file], outputs=[output_gallery])
|
19 |
+
|
20 |
+
if __name__ == '__main__':
|
21 |
+
interface.launch()
|