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