Dumeng commited on
Commit
1451a3d
1 Parent(s): 4b982eb

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. iris.py +4 -3
iris.py CHANGED
@@ -22,7 +22,8 @@ def ClassifyIris(sliSepalLength, sliSepalWidth, sliPetalLength, sliPetalWidth):
22
  intPrediction = a1intPredictions[0]
23
  dstrIndexToSpecies = {0: "setosa", 1: "versicolor", 2: "virginica"}
24
  strSpecies = dstrIndexToSpecies[intPrediction]
25
- return f"Iris {strSpecies}"
 
26
 
27
  # interface elements
28
  sliSepalLength = gr.Slider(minimum=4, maximum=9, value=6, label="Sepal length (cm)")
@@ -30,7 +31,7 @@ sliSepalWidth = gr.Slider(minimum=0, maximum=5, value=3, label="Sepal width (cm
30
  sliPetalLength = gr.Slider(minimum=1, maximum=8, value=4, label="Petal length (cm)")
31
  sliPetalWidth = gr.Slider(minimum=0, maximum=3, value=2, label="Petal width (cm)")
32
 
33
- outputs = gr.TextOutput()
34
 
35
  ### result.label = "Iris species" # does not work on Hugging Face
36
 
@@ -44,5 +45,5 @@ gr.Interface(
44
  "learning rate = 0.001, maximum depth = 3, n estimators = 3",
45
  fn=ClassifyIris,
46
  inputs=[sliSepalLength, sliSepalWidth, sliPetalLength, sliPetalWidth],
47
- outputs=outputs, # does not work on Hugging Face
48
  flagging_options=[]).launch(share=True)
 
22
  intPrediction = a1intPredictions[0]
23
  dstrIndexToSpecies = {0: "setosa", 1: "versicolor", 2: "virginica"}
24
  strSpecies = dstrIndexToSpecies[intPrediction]
25
+ result = f"Iris {strSpecies}"
26
+ return result
27
 
28
  # interface elements
29
  sliSepalLength = gr.Slider(minimum=4, maximum=9, value=6, label="Sepal length (cm)")
 
31
  sliPetalLength = gr.Slider(minimum=1, maximum=8, value=4, label="Petal length (cm)")
32
  sliPetalWidth = gr.Slider(minimum=0, maximum=3, value=2, label="Petal width (cm)")
33
 
34
+ ###outputs = gr.TextOutput()
35
 
36
  ### result.label = "Iris species" # does not work on Hugging Face
37
 
 
45
  "learning rate = 0.001, maximum depth = 3, n estimators = 3",
46
  fn=ClassifyIris,
47
  inputs=[sliSepalLength, sliSepalWidth, sliPetalLength, sliPetalWidth],
48
+ outputs=result, # does not work on Hugging Face
49
  flagging_options=[]).launch(share=True)