File size: 670 Bytes
b245327
 
4650f40
222f9a3
fef6a07
b245327
b801442
28157ff
fef6a07
 
 
 
 
 
 
28157ff
b801442
 
 
c8e4656
b801442
eb59bea
b801442
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import numpy as np
import zipfile
from PIL import Image
import tempfile

def flip_image(image):
    image = Image.fromarray(np.uint8(image))
    # Create a temporary file
    with tempfile.NamedTemporaryFile(suffix='.jpg') as temp:
        # Save the image to the temporary file
        image.save(temp.name)
        # Create zip file
        with zipfile.ZipFile("image.zip", 'w') as zip:
            zip.write(temp.name)
    return "image.zip"
    
gr.Interface(fn=flip_image,
             inputs="image",
             outputs="file",
             title="Flip An Image Upside Down",
             examples = ["example.jpg"]  
            ).launch();