File size: 766 Bytes
01a7219
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from zipfile import ZipFile

def extract_snapshots(watchface_link):
    with ZipFile(watchface_link, 'r') as zObject:
        snapshot = zObject.extract('snapshot.png', path='outputs')
        bordless_snapshot = zObject.extract('no_borders_snapshot.png', path='outputs')
        return [snapshot, bordless_snapshot]


with gr.Blocks() as interface:
    with gr.Column():
        input_file = gr.File(label="Watchface file", file_count='single', file_types=['watchface'])
        btn = gr.Button(variant='primary', value="Extract!!")
    with gr.Row():
        output_gallery = gr.Gallery(label="Output images")

    btn.click(fn=extract_snapshots, inputs=[input_file], outputs=[output_gallery])

if __name__ == '__main__':
    interface.launch()