Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from indexer import FAISS
|
| 3 |
+
# from annotated_text import annotated_text
|
| 4 |
+
import pymorphy2
|
| 5 |
+
|
| 6 |
+
morph = pymorphy2.MorphAnalyzer()
|
| 7 |
+
indexer_vector_dim = 384
|
| 8 |
+
indexer = FAISS(indexer_vector_dim)
|
| 9 |
+
indexer.init_index('vector.index')
|
| 10 |
+
indexer.init_vectors('data.pkl')
|
| 11 |
+
|
| 12 |
+
|
| 13 |
+
def main():
|
| 14 |
+
st.set_page_config(layout="wide")
|
| 15 |
+
st.header('Модель предложения тэгов')
|
| 16 |
+
|
| 17 |
+
x = st.text_input(label='Введите запрос')
|
| 18 |
+
if x != '':
|
| 19 |
+
# result = indexer.suggest_tags(x)
|
| 20 |
+
st.write(" / ".join(indexer.suggest_tags(x)))
|
| 21 |
+
# cols = st.beta_columns((1, 1, 1, 1, 1, 1, 1, 1, 1, 1))
|
| 22 |
+
# for i in range(len(result)):
|
| 23 |
+
# cols[i].subheader(result[i])
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
if __name__ == '__main__':
|
| 27 |
+
main()
|