Spaces:
Runtime error
Runtime error
Commit
·
26bbddb
1
Parent(s):
c026d3f
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# -*- coding: utf-8 -*-
|
2 |
+
|
3 |
+
|
4 |
+
import gradio as gr
|
5 |
+
import image_classification
|
6 |
+
|
7 |
+
def start_classification(image_path):
|
8 |
+
return image_classification.imageClassification(image_path)
|
9 |
+
|
10 |
+
|
11 |
+
with gr.Blocks() as demo:
|
12 |
+
image_path = gr.Image(type="filepath",label="请选择一张图片")
|
13 |
+
#question = gr.Textbox(label="输入您的问题",lines=2)
|
14 |
+
output = gr.Textbox(label="输出分类",lines=2,placeholder="提交后将自动对图片进行分类")
|
15 |
+
greet_btn = gr.Button("提交",variant="primary")
|
16 |
+
greet_btn.click(fn=start_classification, inputs=[image_path], outputs=output, api_name="start_classification")
|
17 |
+
|
18 |
+
|
19 |
+
demo.close()
|
20 |
+
demo.launch(server_port=6006)
|
21 |
+
|
22 |
+
#demo.launch(share=True)
|