|
import gradio as gr |
|
import numpy as np |
|
from pathlib import Path |
|
|
|
EXAMPLES_PATH = Path('./examples') |
|
|
|
title = "Ethiopian Foods" |
|
description = """ |
|
The bot was trained to answer questions based on Rick and Morty dialogues. Ask Rick anything! |
|
""" |
|
|
|
article = "Check out [the original Rick and Morty Bot](https://huggingface.co/spaces/kingabzpro/Rick_and_Morty_Bot) that this demo is based off of." |
|
|
|
def sepia(input_img): |
|
sepia_filter = np.array( |
|
[[0.393, 0.769, 0.189], [0.349, 0.686, 0.168], [0.272, 0.534, 0.131]] |
|
) |
|
sepia_img = input_img.dot(sepia_filter.T) |
|
sepia_img /= sepia_img.max() |
|
return sepia_img |
|
|
|
|
|
examples = [f'{EXAMPLES_PATH}/{f.name}' for f in EXAMPLES_PATH.iterdir()] |
|
|
|
demo = gr.Interface(sepia, |
|
"image", |
|
"image", |
|
|
|
examples= examples, |
|
title=title, |
|
description=description, |
|
article=article) |
|
|
|
demo.launch() |