Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,14 +27,29 @@ def predict(name, description):
|
|
27 |
IRDI2 = corpus.iloc[output[0][1].get('corpus_id'),4]
|
28 |
score2 = output[0][1].get('score')
|
29 |
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
|
32 |
return pd.DataFrame(df)
|
33 |
|
34 |
interface = gr.Interface(fn = predict,
|
35 |
inputs = [gr.Textbox(label="Name:", placeholder="z.B. GTIN", lines=1), gr.Textbox(label="Description:", placeholder="z.B. Globel Trade Item Number", lines=1)],
|
36 |
#outputs = [gr.Textbox(label = 'preferedName'),gr.Textbox(label = 'definition'), gr.Textbox(label = 'IDRI'),gr.Textbox(label = 'score')],
|
37 |
-
outputs = [gr.Dataframe(row_count = (
|
38 |
examples = [['GTIN', 'Globel Trade Item Number'], ['Global Trade Item Number', 'the identification number from the GS1 system with which the trading units can be uniquely identified worldwide'],
|
39 |
['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'],
|
40 |
['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']], theme = 'huggingface',
|
|
|
27 |
IRDI2 = corpus.iloc[output[0][1].get('corpus_id'),4]
|
28 |
score2 = output[0][1].get('score')
|
29 |
|
30 |
+
preferedName3 = corpus.iloc[output[0][2].get('corpus_id'),2]
|
31 |
+
definition3 = corpus.iloc[output[0][2].get('corpus_id'),1]
|
32 |
+
IRDI3 = corpus.iloc[output[0][2].get('corpus_id'),4]
|
33 |
+
score3 = output[0][2].get('score')
|
34 |
+
|
35 |
+
preferedName4 = corpus.iloc[output[0][3].get('corpus_id'),2]
|
36 |
+
definition4 = corpus.iloc[output[0][3].get('corpus_id'),1]
|
37 |
+
IRDI4 = corpus.iloc[output[0][3].get('corpus_id'),4]
|
38 |
+
score4 = output[0][3].get('score')
|
39 |
+
|
40 |
+
preferedName5 = corpus.iloc[output[0][4].get('corpus_id'),2]
|
41 |
+
definition5 = corpus.iloc[output[0][4].get('corpus_id'),1]
|
42 |
+
IRDI5 = corpus.iloc[output[0][4].get('corpus_id'),4]
|
43 |
+
score5 = output[0][4].get('score')
|
44 |
+
|
45 |
+
df = [[preferedName1, IRDI1, score1], [preferedName2, IRDI2, score2],[preferedName3, IRDI3, score3],[preferedName4, IRDI4, score4], [preferedName5, IRDI5, score5]]
|
46 |
|
47 |
return pd.DataFrame(df)
|
48 |
|
49 |
interface = gr.Interface(fn = predict,
|
50 |
inputs = [gr.Textbox(label="Name:", placeholder="z.B. GTIN", lines=1), gr.Textbox(label="Description:", placeholder="z.B. Globel Trade Item Number", lines=1)],
|
51 |
#outputs = [gr.Textbox(label = 'preferedName'),gr.Textbox(label = 'definition'), gr.Textbox(label = 'IDRI'),gr.Textbox(label = 'score')],
|
52 |
+
outputs = [gr.Dataframe(row_count = (5, "fixed"), col_count=(3, "fixed"), label="Predictions", headers=['preferedName', 'IRDI', 'score'])],
|
53 |
examples = [['GTIN', 'Globel Trade Item Number'], ['Global Trade Item Number', 'the identification number from the GS1 system with which the trading units can be uniquely identified worldwide'],
|
54 |
['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'],
|
55 |
['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']], theme = 'huggingface',
|