sunnychenxiwang commited on
Commit
ca86d9d
1 Parent(s): ad4956a
Files changed (1) hide show
  1. app.py +30 -13
app.py CHANGED
@@ -1,4 +1,4 @@
1
- import gradio as gr
2
  # import sys
3
  # sys.path.append("/home/wcx/wcx/EasyDetect/pipeline")
4
 
@@ -22,17 +22,34 @@ import gradio as gr
22
 
23
  # demo.launch()
24
 
25
- def generate_mutimodal(title, context, img):
26
- return f"Title:{title}\nContext:{context}\n...{img}"
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- server = gr.Interface(
29
- fn=generate_mutimodal,
30
- inputs=[
31
- gr.Textbox(lines=1, placeholder="请输入标题"),
32
- gr.Textbox(lines=2, placeholder="请输入正文"),
33
- gr.Image(shape=(200, 200), label="请上传图片(可选)")
34
- ],
35
- outputs="text"
36
- )
 
 
 
 
 
 
37
 
38
- server.launch()
 
1
+
2
  # import sys
3
  # sys.path.append("/home/wcx/wcx/EasyDetect/pipeline")
4
 
 
22
 
23
  # demo.launch()
24
 
25
+ # def generate_mutimodal(title, context, img):
26
+ # return f"Title:{title}\nContext:{context}\n...{img}"
27
+
28
+ # server = gr.Interface(
29
+ # fn=generate_mutimodal,
30
+ # inputs=[
31
+ # gr.Textbox(lines=1, placeholder="请输入标题"),
32
+ # gr.Textbox(lines=2, placeholder="请输入正文"),
33
+ # gr.Image(shape=(200, 200), label="请上传图片(可选)")
34
+ # ],
35
+ # outputs="text"
36
+ # )
37
+
38
+ # server.launch()
39
 
40
+ import numpy as np
41
+ import gradio as gr
42
+ def sepia(input_img):
43
+ #处理图像
44
+ sepia_filter = np.array([
45
+ [0.393, 0.769, 0.189],
46
+ [0.349, 0.686, 0.168],
47
+ [0.272, 0.534, 0.131]
48
+ ])
49
+ sepia_img = input_img.dot(sepia_filter.T)
50
+ sepia_img /= sepia_img.max()
51
+ return sepia_img
52
+ #shape设置输入图像大小
53
+ demo = gr.Interface(sepia, gr.Image(shape=(200, 200)), "image")
54
+ demo.launch()
55