sunnychenxiwang commited on
Commit
50e84c0
1 Parent(s): 69e3a48

app update

Browse files
Files changed (1) hide show
  1. app.py +25 -26
app.py CHANGED
@@ -1,26 +1,25 @@
1
 
2
- # import sys
3
- # sys.path.append("/home/wcx/wcx/EasyDetect/pipeline")
4
-
5
  # from run import *
6
  # '''
7
  # 把一些文件移动到此文件路径下
8
  # '''
9
  # text = "A person is cutting a birthday cake with two red candles that spell out \"21\". The surface of the cake is round, and there is a balloon in the room. The person is using a silver knife to cut the cake."
10
  # image_path = "/newdisk3/wcx/val2014/COCO_val2014_000000297425.jpg"
11
- # pipeline = Pipeline()
12
- # res = pipeline.run(text=text, image_path=image_path)
13
 
14
- # def greet(name, cnt):
15
- # return "Hello " * cnt + name + "!"
 
 
16
 
17
- # demo = gr.Interface(
18
- # fn=greet,
19
- # inputs=["text", "slider"],
20
- # outputs=["text"],
21
- # )
22
 
23
- # demo.launch()
24
 
25
  # def generate_mutimodal(title, context, img):
26
  # return f"Title:{title}\nContext:{context}\n...{img}"
@@ -37,23 +36,23 @@
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(), "image")
54
  # demo.launch()
55
 
56
  # Download human-readable labels for ImageNet.
57
 
58
- gr.Interface(fn=sepia,inputs=gr.Image(type="pil"),outputs="image").launch()
59
 
 
1
 
2
+ import gradio as gr
3
+ from pipeline.run_pipeline import *
 
4
  # from run import *
5
  # '''
6
  # 把一些文件移动到此文件路径下
7
  # '''
8
  # text = "A person is cutting a birthday cake with two red candles that spell out \"21\". The surface of the cake is round, and there is a balloon in the room. The person is using a silver knife to cut the cake."
9
  # image_path = "/newdisk3/wcx/val2014/COCO_val2014_000000297425.jpg"
 
 
10
 
11
+ def get_response(text, filepath):
12
+ pipeline = Pipeline()
13
+ res = pipeline.run(text=text, image_path=image_path)
14
+ return res
15
 
16
+ demo = gr.Interface(
17
+ fn=get_response,
18
+ inputs=["text", gr.Image(type="filepath")],
19
+ outputs=["text"],
20
+ )
21
 
22
+ demo.launch()
23
 
24
  # def generate_mutimodal(title, context, img):
25
  # return f"Title:{title}\nContext:{context}\n...{img}"
 
36
 
37
  # server.launch()
38
 
39
+ # import numpy as np
40
+ # import gradio as gr
41
+ # def sepia(input_img):
42
+ # #处理图像
43
+ # sepia_filter = np.array([
44
+ # [0.393, 0.769, 0.189],
45
+ # [0.349, 0.686, 0.168],
46
+ # [0.272, 0.534, 0.131]
47
+ # ])
48
+ # sepia_img = input_img.dot(sepia_filter.T)
49
+ # sepia_img /= sepia_img.max()
50
+ # return sepia_img
51
  # #shape设置输入图像大小
52
  # demo = gr.Interface(sepia, gr.Image(), "image")
53
  # demo.launch()
54
 
55
  # Download human-readable labels for ImageNet.
56
 
57
+ # gr.Interface(fn=sepia,inputs=gr.Image(type="pil"),outputs="image").launch()
58