c2p-cmd's picture
Create app.py
01a7219 verified
raw
history blame
766 Bytes
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()