WQW commited on
Commit
2536c7b
1 Parent(s): 154c916

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -0
app.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+ import gradio as gr
3
+
4
+ def flip_text(x):
5
+ return x[::-1]
6
+
7
+ def extract_qa(question):
8
+ """
9
+ 抽取式qa
10
+ """
11
+ return question
12
+
13
+ def flip_image(x):
14
+ return np.fliplr(x)
15
+
16
+ with gr.Blocks() as demo:
17
+ gr.Markdown("""
18
+ # 自研大语言模型DEMO
19
+ - 抽取式QA
20
+ - 小区测评
21
+ """)
22
+ with gr.Tab("抽取式QA"):
23
+ text_input = gr.Textbox(label="输入",placeholder="默认值")
24
+ gr.Examples(["出租出去的房屋家电坏了,应该谁负责出维修费用?", "退租房东不还押金怎么办?"], inputs=text_input)
25
+ text_button = gr.Button("提交")
26
+ text_output = gr.Textbox(label="输出")
27
+
28
+ with gr.Tab("小区测评"):
29
+ #text_input = gr.Textbox()
30
+ text_input = gr.Textbox(label="输入",placeholder="默认值")
31
+ gr.Examples(["出租出去的房屋家电坏了,应该谁负责出维修费用?", "退租房东不还押金怎么办?"], inputs=text_input)
32
+ #text_output = gr.Textbox()
33
+ text_button = gr.Button("提交")
34
+ text_output = gr.Textbox(label="输出")
35
+
36
+ with gr.Tab("图像测试"):
37
+ with gr.Row():
38
+ image_input = gr.Image()
39
+ image_output = gr.Image()
40
+ image_button = gr.Button("翻转")
41
+
42
+ with gr.Accordion("备注"):
43
+ gr.Markdown("DEMO基于幸福里策略算法组自研大语言模型")
44
+
45
+ text_button.click(extract_qa, inputs=text_input, outputs=text_output)
46
+ #text_button.click(flip_text, inputs=text_input, outputs=text_output)
47
+ image_button.click(flip_image, inputs=image_input, outputs=image_output)
48
+
49
+ demo.launch(share=True)