File size: 1,597 Bytes
6332d06
b5d03c5
6332d06
 
 
1feaf10
6332d06
1feaf10
 
 
6332d06
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c748a5f
6332d06
 
 
 
1b90c7f
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <title>Gradio-Lite: Stable Version</title>
        
        <!-- Pinned to a known-working version (4.43.0) to bypass Pyodide 0.27.3 bugs -->
        <script type="module" crossorigin src="https://cdn.jsdelivr.net/npm/@gradio/lite@4.43.0/dist/lite.js"></script>
        <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@gradio/lite@4.43.0/dist/lite.css" />
        
        <style>
            html, body { margin: 0; padding: 0; height: 100%; }
        </style>
    </head>
    <body>
        <gradio-lite>
            <gradio-file name="app.py" entrypoint>
import gradio as gr
from filters import as_gray

def process(input_image):
    output_image = as_gray(input_image)
    return output_image

demo = gr.Interface(
    process,
    "image",
    "image",
    examples=["lion.jpg", "logo.png"],
)
demo.launch()
            </gradio-file>
            
            <gradio-file name="filters.py">
from skimage.color import rgb2gray

def as_gray(image):
    return rgb2gray(image)
            </gradio-file>
            
            <gradio-file name="lion.jpg" url="https://raw.githubusercontent.com/gradio-app/gradio/main/gradio/test_data/lion.jpg" />
            <gradio-file name="logo.png" url="https://raw.githubusercontent.com/gradio-app/gradio/main/guides/assets/logo.png" />
            
            <gradio-requirements>
filelock==3.12.2
scikit-image
            </gradio-requirements>
        </gradio-lite>
    </body>
</html>