Pranav4datasc's picture
Rename sepia-app.py to app.py
04be2b5
raw
history blame contribute delete
No virus
884 Bytes
# MyFirst Gradio Application
import gradio as gr
import numpy as np
def hello_world(name):
return "Hello ....."+name+"!!!!"
def sepia(input_img):
sepia_filter = np.array([[.393, .769, .189],
[.349, .686, .168],
[.272, .534, .131]])
sepia_img = input_img.dot(sepia_filter.T)
sepia_img /= sepia_img.max()
return sepia_img
hello_world("Lets Create a Sepia Filter for your uploaded image ")
#Interface Option 1 - single line text entry
#interface = gr.Interface(fn = hello_world,inputs = 'text', outputs = 'text')
#Interface Option 2 - multiline text entry
#interface = gr.Interface(fn = hello_world,inputs = gr.inputs.Textbox(lines=5,placeholder="Enter your mission statement here"), outputs = 'text')
#Interface Option 3 - convert image to sepia
interface = gr.Interface(sepia, gr.inputs.Image(shape=(200,200)), "image")
#Launch Interface
interface.launch()