Spaces:
Build error
Build error
Добавлена гистограма.
Browse files
app.py
CHANGED
@@ -75,7 +75,9 @@ text = preprocess([title + ". " + abstract])[0]
|
|
75 |
|
76 |
if not text is None and len(text) > 0:
|
77 |
#keywords = get_candidates(text, main_nlp)
|
78 |
-
keywords =
|
|
|
|
|
79 |
#st.markdown(f"{keywords}")
|
80 |
|
81 |
# График важности слов.
|
@@ -83,9 +85,9 @@ if not text is None and len(text) > 0:
|
|
83 |
ax.set_title("Ключевые слова в порядке важности")
|
84 |
|
85 |
bar_width = 0.35
|
86 |
-
indexes = np.arange(
|
87 |
-
ax.barh(indexes,
|
88 |
-
plt.yticks(indexes,
|
89 |
|
90 |
st.pyplot(fig)
|
91 |
else:
|
|
|
75 |
|
76 |
if not text is None and len(text) > 0:
|
77 |
#keywords = get_candidates(text, main_nlp)
|
78 |
+
keywords = get_keywords(text, main_nlp, main_model, main_tokenizer)
|
79 |
+
labels = [kw[0] for kw in keywords]
|
80 |
+
scores = [kw[1] for kw in keywords]
|
81 |
#st.markdown(f"{keywords}")
|
82 |
|
83 |
# График важности слов.
|
|
|
85 |
ax.set_title("Ключевые слова в порядке важности")
|
86 |
|
87 |
bar_width = 0.35
|
88 |
+
indexes = np.arange(len(labels))
|
89 |
+
ax.barh(indexes, scores, bar_width)
|
90 |
+
plt.yticks(indexes, labels=labels)
|
91 |
|
92 |
st.pyplot(fig)
|
93 |
else:
|