hailiang shi commited on
Commit
8c9329f
·
1 Parent(s): 1710977

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -41
app.py CHANGED
@@ -1,41 +1,15 @@
1
- {
2
- "cells": [
3
- {
4
- "cell_type": "code",
5
- "execution_count": null,
6
- "metadata": {},
7
- "outputs": [],
8
- "source": [
9
- "import gradio as gr\n",
10
- "\n",
11
- "def greet(name):\n",
12
- " return \"Hello \" + name + \"!\"\n",
13
- "\n",
14
- "demo = gr.Interface(fn=greet, inputs=\"text\", outputs=\"text\")\n",
15
- "\n",
16
- "demo.launch(share=True) "
17
- ]
18
- }
19
- ],
20
- "metadata": {
21
- "kernelspec": {
22
- "display_name": "Python 3",
23
- "language": "python",
24
- "name": "python3"
25
- },
26
- "language_info": {
27
- "codemirror_mode": {
28
- "name": "ipython",
29
- "version": 3
30
- },
31
- "file_extension": ".py",
32
- "mimetype": "text/x-python",
33
- "name": "python",
34
- "nbconvert_exporter": "python",
35
- "pygments_lexer": "ipython3",
36
- "version": "3.8.5"
37
- }
38
- },
39
- "nbformat": 4,
40
- "nbformat_minor": 4
41
- }
 
1
+ import numpy as np
2
+ import gradio as gr
3
+
4
+ def sepia(input_img):
5
+ sepia_filter = np.array([
6
+ [0.393, 0.769, 0.189],
7
+ [0.349, 0.686, 0.168],
8
+ [0.272, 0.534, 0.131]
9
+ ])
10
+ sepia_img = input_img.dot(sepia_filter.T)
11
+ sepia_img /= sepia_img.max()
12
+ return sepia_img
13
+
14
+ demo = gr.Interface(sepia, gr.Image(shape=(200, 200)), "image")
15
+ demo.launch(share=True)