voroninip commited on
Commit
123a600
·
verified ·
1 Parent(s): f954621

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -13
app.py CHANGED
@@ -3,17 +3,11 @@ import streamlit as st
3
  from transformers import pipeline
4
 
5
 
6
- # @st.cache_resource # кэширование
7
- # def load_model():
8
- # return pipeline("text-classification", model="Wi/arxiv-distilbert-base-cased") # скачивание модели
9
- #
10
- # model = load_model()
11
 
12
- # @st.cache_resource # кэширование
13
- # def load_model():
14
- # return pipeline("sentiment-analysis") # скачивание модели
15
-
16
- # model = load_model()
17
 
18
  def top_pct(preds, threshold=.95):
19
  preds = sorted(preds, key=lambda x: -x["score"])
@@ -91,7 +85,5 @@ if query:
91
  Most likely categories of the paper:
92
  </p>
93
  """, unsafe_allow_html=True)
94
- # result = format_predictions(top_pct(model(query)[0]))
95
- # result = query
96
- # result = model(query)[0]
97
  st.write(result)
 
3
  from transformers import pipeline
4
 
5
 
6
+ @st.cache_resource # кэширование
7
+ def load_model():
8
+ return pipeline("text-classification", model="voroninip/bert-paper-classifier-arxiv", top_k=None) # скачивание модели
 
 
9
 
10
+ model = load_model()
 
 
 
 
11
 
12
  def top_pct(preds, threshold=.95):
13
  preds = sorted(preds, key=lambda x: -x["score"])
 
85
  Most likely categories of the paper:
86
  </p>
87
  """, unsafe_allow_html=True)
88
+ result = format_predictions(top_pct(model(query)[0]))
 
 
89
  st.write(result)