demo / app.py
WQW's picture
修复
2d4db66
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()