Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -6,6 +6,7 @@ from transformers import pipeline
|
|
6 |
def get_model(model):
|
7 |
return pipeline("fill-mask", model=model, top_k=100)
|
8 |
|
|
|
9 |
|
10 |
|
11 |
|
@@ -25,8 +26,7 @@ if text:
|
|
25 |
data_load_state.text('')
|
26 |
for index, r in enumerate(result):
|
27 |
if r['token_str'].lower().strip() in history_keyword_text.lower().strip():
|
28 |
-
|
29 |
-
result[index]['score']*=100
|
30 |
|
31 |
result={k: v for k, v in sorted(result.items(), key=lambda item: item[0])}
|
32 |
st.table(result)
|
|
|
6 |
def get_model(model):
|
7 |
return pipeline("fill-mask", model=model, top_k=100)
|
8 |
|
9 |
+
HISTORY_WEIGHT = 100 # set history weight (if found any keyword from history, it will priorities based on its weight)
|
10 |
|
11 |
|
12 |
|
|
|
26 |
data_load_state.text('')
|
27 |
for index, r in enumerate(result):
|
28 |
if r['token_str'].lower().strip() in history_keyword_text.lower().strip():
|
29 |
+
result[index]['score']*=HISTORY_WEIGHT
|
|
|
30 |
|
31 |
result={k: v for k, v in sorted(result.items(), key=lambda item: item[0])}
|
32 |
st.table(result)
|