Spaces:
Runtime error
Runtime error
Commit ·
576a3f2
1
Parent(s): 0c0c8d4
Create sepia-app.py
Browse files- sepia-app.py +28 -0
sepia-app.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# MyFirst Gradio Application
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import numpy as np
|
| 4 |
+
|
| 5 |
+
def hello_world(name):
|
| 6 |
+
return "Hello ....."+name+"!!!!"
|
| 7 |
+
|
| 8 |
+
def sepia(input_img):
|
| 9 |
+
sepia_filter = np.array([[.393, .769, .189],
|
| 10 |
+
[.349, .686, .168],
|
| 11 |
+
[.272, .534, .131]])
|
| 12 |
+
|
| 13 |
+
sepia_img = input_img.dot(sepia_filter.T)
|
| 14 |
+
sepia_img /= sepia_img.max()
|
| 15 |
+
return sepia_img
|
| 16 |
+
|
| 17 |
+
hello_world("Lets Create a Sepia Filter for your uploaded image ")
|
| 18 |
+
|
| 19 |
+
#Interface Option 1 - single line text entry
|
| 20 |
+
#interface = gr.Interface(fn = hello_world,inputs = 'text', outputs = 'text')
|
| 21 |
+
|
| 22 |
+
#Interface Option 2 - multiline text entry
|
| 23 |
+
#interface = gr.Interface(fn = hello_world,inputs = gr.inputs.Textbox(lines=5,placeholder="Enter your mission statement here"), outputs = 'text')
|
| 24 |
+
|
| 25 |
+
#Interface Option 3 - convert image to sepia
|
| 26 |
+
interface = gr.Interface(sepia, gr.inputs.Image(shape=(200,200)), "image")
|
| 27 |
+
#Launch Interface
|
| 28 |
+
interface.launch()
|