saad177 commited on
Commit
eba27f6
1 Parent(s): 708f112

update app

Browse files
Files changed (1) hide show
  1. app.py +5 -10
app.py CHANGED
@@ -17,16 +17,11 @@ print("Model downloaded")
17
 
18
  def iris(sepal_length, sepal_width, petal_length, petal_width):
19
  print("Calling function")
20
- # df = pd.DataFrame([[sepal_length],[sepal_width],[petal_length],[petal_width]],
21
  df = pd.DataFrame([[sepal_length, sepal_width, petal_length, petal_width]],
22
  columns=['sepal_length', 'sepal_width', 'petal_length', 'petal_width'])
23
  print("Predicting")
24
  print(df)
25
- # 'res' is a list of predictions returned as the label.
26
  res = model.predict(df)
27
- # We add '[0]' to the result of the transformed 'res', because 'res' is a list, and we only want
28
- # the first element.
29
- # print("Res: {0}").format(res)
30
  print(res)
31
  flower_url = "https://raw.githubusercontent.com/featurestoreorg/serverless-ml-course/main/src/01-module/assets/" + \
32
  res[0] + ".png"
@@ -40,11 +35,11 @@ demo = gr.Interface(
40
  description="Experiment with sepal/petal lengths/widths to predict which flower it is.",
41
  allow_flagging="never",
42
  inputs=[
43
- gr.Number(default=2.0, label="sepal length (cm)"),
44
- gr.Number(default=1.0, label="sepal width (cm)"),
45
- gr.Number(default=2.0, label="petal length (cm)"),
46
- gr.Number(default=1.0, label="petal width (cm)"),
47
  ],
48
  outputs=gr.Image(type="pil"))
49
 
50
- demo.launch(debug=True)
 
17
 
18
  def iris(sepal_length, sepal_width, petal_length, petal_width):
19
  print("Calling function")
 
20
  df = pd.DataFrame([[sepal_length, sepal_width, petal_length, petal_width]],
21
  columns=['sepal_length', 'sepal_width', 'petal_length', 'petal_width'])
22
  print("Predicting")
23
  print(df)
 
24
  res = model.predict(df)
 
 
 
25
  print(res)
26
  flower_url = "https://raw.githubusercontent.com/featurestoreorg/serverless-ml-course/main/src/01-module/assets/" + \
27
  res[0] + ".png"
 
35
  description="Experiment with sepal/petal lengths/widths to predict which flower it is.",
36
  allow_flagging="never",
37
  inputs=[
38
+ gr.Number(label="sepal length (cm)"),
39
+ gr.Number(label="sepal width (cm)"),
40
+ gr.Number(label="petal length (cm)"),
41
+ gr.Number(label="petal width (cm)"),
42
  ],
43
  outputs=gr.Image(type="pil"))
44
 
45
+ demo.launch(debug=True)