shane666 commited on
Commit
68c6bf2
·
1 Parent(s): d38155a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -7,6 +7,7 @@ import pandas as pd
7
  import numpy as np
8
  import pydotplus
9
  import gradio as gr
 
10
 
11
 
12
  def Tree_Detection(sample):
@@ -51,7 +52,9 @@ def Tree_Detection(sample):
51
 
52
  result = f'The fault type is:{clf.predict([sample])[0]}' # 预测
53
 
54
- return result
 
 
55
  # print(Tree_Detection([2, 1, 1, 0]))
56
 
57
  def test(image):
@@ -61,7 +64,7 @@ def test(image):
61
  demo = gr.Interface(
62
  fn=Tree_Detection,
63
  inputs='text',
64
- outputs='text'
65
  )
66
  demo.launch()
67
 
 
7
  import numpy as np
8
  import pydotplus
9
  import gradio as gr
10
+ from PIL import Image
11
 
12
 
13
  def Tree_Detection(sample):
 
52
 
53
  result = f'The fault type is:{clf.predict([sample])[0]}' # 预测
54
 
55
+ image = Image.open("tree.jpg")
56
+
57
+ return result, image
58
  # print(Tree_Detection([2, 1, 1, 0]))
59
 
60
  def test(image):
 
64
  demo = gr.Interface(
65
  fn=Tree_Detection,
66
  inputs='text',
67
+ outputs=['text', 'image']
68
  )
69
  demo.launch()
70