# -*- coding: utf-8 -*- | |
import gradio as gr | |
import langChain_test | |
def image_to_text(image_path,question): | |
return langChain_test.imageAnalyse(image_path,question) | |
with gr.Blocks() as demo: | |
image_path = gr.Image(type="filepath",label="请选择一张图片") | |
question = gr.Textbox(label="输入您的问题",lines=2) | |
output = gr.Textbox(label="输出答案",lines=2,placeholder="提交后将自动输出答案") | |
greet_btn = gr.Button("提交",variant="primary") | |
greet_btn.click(fn=image_to_text, inputs=[image_path,question], outputs=output, api_name="image_to_text") | |
demo.launch() | |
#demo.launch(share=True) |