Spaces:
Runtime error
Runtime error
tomaseo2022
commited on
Commit
•
82c4d4c
1
Parent(s):
9abd07c
Update app.py
Browse files
app.py
CHANGED
@@ -2,13 +2,32 @@ import numpy as np
|
|
2 |
import gradio as gr
|
3 |
|
4 |
def sepia(input_img):
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
iface = gr.Interface(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
iface.launch()
|
14 |
|
|
|
|
2 |
import gradio as gr
|
3 |
|
4 |
def sepia(input_img):
|
5 |
+
sepia_filter = np.array(
|
6 |
+
[[0.393, 0.769, 0.189], [0.349, 0.686, 0.168], [0.272, 0.534, 0.131]]
|
7 |
+
)
|
8 |
+
sepia_img = input_img.dot(sepia_filter.T)
|
9 |
+
sepia_img /= sepia_img.max()
|
10 |
+
return sepia_img
|
11 |
+
|
12 |
+
iface = gr.Interface(
|
13 |
+
sepia,
|
14 |
+
gr.inputs.Image(),
|
15 |
+
"image",
|
16 |
+
title="Convertidor de imagen a sepia",
|
17 |
+
description="Sube una imagen y conviértela a sepia.",
|
18 |
+
css=".footer{display:none !important}",
|
19 |
+
inputs=[
|
20 |
+
gr.inputs.Image(label="Imagen de entrada")
|
21 |
+
],
|
22 |
+
outputs=[
|
23 |
+
gr.outputs.Image(label="Imagen sepia")
|
24 |
+
],
|
25 |
+
examples=[
|
26 |
+
["https://live.staticflickr.com/65535/51275594794_b6163c1ea6_z.jpg"]
|
27 |
+
],
|
28 |
+
theme="compact",
|
29 |
+
button_labels=["Limpiar", "Convertir a sepia"]
|
30 |
+
)
|
31 |
iface.launch()
|
32 |
|
33 |
+
|