JoBeer commited on
Commit
16e66e6
1 Parent(s): cc5a64b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -21,12 +21,17 @@ def predict(name, description):
21
  definition1 = corpus.iloc[output[0][0].get('corpus_id'),1]
22
  IRDI1 = corpus.iloc[output[0][0].get('corpus_id'),4]
23
  score1 = output[0][0].get('score')
24
-
25
- return preferedName1, definition1, IRDI1, score1
 
 
 
 
 
26
 
27
  interface = gr.Interface(fn = predict,
28
  inputs = [gr.Textbox(label="Name:", placeholder="Name of the Pump Property", lines=1), gr.Textbox(label="Description:", placeholder="Description of the Pump Property", lines=1)],
29
- outputs = [gr.Textbox(label = 'preferedName'),gr.Textbox(label = 'definition'), gr.Textbox(label = 'IDRI'),gr.Textbox(label = 'score')],
30
  #outputs = [gr.Dataframe(row_count = (5, "fixed"), col_count=(3, "fixed"), label="Predictions", headers=['ECLASS preferedName', 'ECLASS IRDI', 'simularity score'])],
31
  examples = [['Device type', 'describing a set of common specific characteristics in products or goods'], ['Item type','the type of product, an item can be assigned to'],
32
  ['Nominal power','power being consumed by or dissipated within an electric component as a variable'], ['Power consumption', 'power that is typically taken from the auxiliary power supply when the device is operating normally']],
 
21
  definition1 = corpus.iloc[output[0][0].get('corpus_id'),1]
22
  IRDI1 = corpus.iloc[output[0][0].get('corpus_id'),4]
23
  score1 = output[0][0].get('score')
24
+ if score1 < 0.5:
25
+ reliable = 'false'
26
+ else:
27
+ reliable = 'true'
28
+ scoreOutput = reliable + ' score: ' + score1
29
+
30
+ return preferedName1, definition1, IRDI1, scoreOutput
31
 
32
  interface = gr.Interface(fn = predict,
33
  inputs = [gr.Textbox(label="Name:", placeholder="Name of the Pump Property", lines=1), gr.Textbox(label="Description:", placeholder="Description of the Pump Property", lines=1)],
34
+ outputs = [gr.Textbox(label = 'preferedName'),gr.Textbox(label = 'definition'), gr.Textbox(label = 'IDRI'),gr.Textbox(label = 'prediction reliable')],
35
  #outputs = [gr.Dataframe(row_count = (5, "fixed"), col_count=(3, "fixed"), label="Predictions", headers=['ECLASS preferedName', 'ECLASS IRDI', 'simularity score'])],
36
  examples = [['Device type', 'describing a set of common specific characteristics in products or goods'], ['Item type','the type of product, an item can be assigned to'],
37
  ['Nominal power','power being consumed by or dissipated within an electric component as a variable'], ['Power consumption', 'power that is typically taken from the auxiliary power supply when the device is operating normally']],