Spaces:
Sleeping
Sleeping
File size: 830 Bytes
a1f30f8 94241e7 709ceea 94241e7 2fef7a3 94241e7 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
import gradio as gr
import monkey
import tempfile
def encoder(data):
fp = tempfile.NamedTemporaryFile(suffix=".png").name
img = monkey.encode(data)
img.save(fp)
return img, fp
def decoder(input_image):
return monkey.decode(input_image)
idecoder = gr.Interface(
fn=decoder,
inputs=gr.Image(type="pil", label="image to decode"),
outputs=gr.Text(label="decoded text"),
description="### Decode the data stored in your monkeys into readable text.",
)
iencoder = gr.Interface(
fn=encoder,
inputs=gr.Text(label="text to encode"),
outputs=[gr.Image(label="image"), gr.File(label="download file")],
description="### Encode your highly sensitive text data (/s) into trustworthy monkeys.",
)
iface = gr.TabbedInterface([iencoder, idecoder], ["encoder", "decoder"])
iface.launch()
|