File size: 698 Bytes
26bbddb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf-8 -*-


import gradio as gr
import image_classification
 
def start_classification(image_path):
    return image_classification.imageClassification(image_path)
    
 
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=start_classification, inputs=[image_path], outputs=output, api_name="start_classification")


demo.close()
demo.launch(server_port=6006) 
 
#demo.launch(share=True)