Spaces:
Runtime error
Runtime error
prateekagrawal
commited on
Commit
•
8754e0c
1
Parent(s):
7b0fb0e
Updated inference.py
Browse files- apps/inference.py +13 -3
apps/inference.py
CHANGED
@@ -6,6 +6,7 @@ from transformers import pipeline
|
|
6 |
import os
|
7 |
import json
|
8 |
|
|
|
9 |
models = []
|
10 |
predicted_tokens = []
|
11 |
predicted_sentence = []
|
@@ -53,9 +54,18 @@ def app():
|
|
53 |
],
|
54 |
["flax-community/roberta-hindi"],
|
55 |
)
|
56 |
-
|
57 |
if st.button("Fill the Mask!"):
|
58 |
with st.spinner("Filling the Mask..."):
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
|
|
|
6 |
import os
|
7 |
import json
|
8 |
|
9 |
+
|
10 |
models = []
|
11 |
predicted_tokens = []
|
12 |
predicted_sentence = []
|
|
|
54 |
],
|
55 |
["flax-community/roberta-hindi"],
|
56 |
)
|
|
|
57 |
if st.button("Fill the Mask!"):
|
58 |
with st.spinner("Filling the Mask..."):
|
59 |
+
|
60 |
+
for i in range(len(selected_models)):
|
61 |
+
filled_sentence = load_model(masked_text, selected_models[i])
|
62 |
+
models.append(selected_models[i])
|
63 |
+
predicted_tokens.append(filled_sentence["token_str"])
|
64 |
+
predicted_sentence.append(filled_sentence["sequence"])
|
65 |
+
|
66 |
+
results_df = pd.DataFrame()
|
67 |
+
results_df["Model Name"] = models
|
68 |
+
results_df["Predicted Word"] = predicted_tokens
|
69 |
+
results_df["Sentence"] = predicted_sentence
|
70 |
+
st.dataframe(results_df)
|
71 |
|