Spaces:
Runtime error
Runtime error
train models a little
Browse files- app.py +6 -4
- bert_pretrained.pt +1 -1
app.py
CHANGED
|
@@ -5,10 +5,12 @@ import streamlit as st
|
|
| 5 |
|
| 6 |
from transformers import BertTokenizer
|
| 7 |
|
| 8 |
-
st.markdown("### Из какой
|
|
|
|
|
|
|
| 9 |
# st.markdown("<img width=200px src='https://rozetked.me/images/uploads/dwoilp3BVjlE.jpg'>", unsafe_allow_html=True)
|
| 10 |
|
| 11 |
-
# from transformers import
|
| 12 |
|
| 13 |
# pipe = pipeline("ner", "Davlan/distilbert-base-multilingual-cased-ner-hrl")
|
| 14 |
|
|
@@ -34,7 +36,7 @@ class BERTClass(torch.nn.Module):
|
|
| 34 |
out = self.l6(out)
|
| 35 |
return out
|
| 36 |
|
| 37 |
-
@st.cache
|
| 38 |
def load_bert():
|
| 39 |
model = BERTClass(bert_path='bert_pretrained')
|
| 40 |
model.load_state_dict(torch.load('bert_pretrained.pt'))
|
|
@@ -81,7 +83,7 @@ class TinyBERTClass(torch.nn.Module):
|
|
| 81 |
return out
|
| 82 |
|
| 83 |
|
| 84 |
-
@st.cache(suppress_st_warning=True)
|
| 85 |
def load_tiny_bert():
|
| 86 |
model = TinyBERTClass(path = 'tiny_bert_pretrained')
|
| 87 |
model.load_state_dict(torch.load('tiny_bert.pt'))
|
|
|
|
| 5 |
|
| 6 |
from transformers import BertTokenizer
|
| 7 |
|
| 8 |
+
st.markdown("### Из какой области статья")
|
| 9 |
+
link = 'https://www.clipartmax.com/png/middle/87-873210_akinator-with-transparent-background.png'
|
| 10 |
+
st.markdown(f"<img width=200px src='{link}'>", unsafe_allow_html=True)
|
| 11 |
# st.markdown("<img width=200px src='https://rozetked.me/images/uploads/dwoilp3BVjlE.jpg'>", unsafe_allow_html=True)
|
| 12 |
|
| 13 |
+
# from transformers import
|
| 14 |
|
| 15 |
# pipe = pipeline("ner", "Davlan/distilbert-base-multilingual-cased-ner-hrl")
|
| 16 |
|
|
|
|
| 36 |
out = self.l6(out)
|
| 37 |
return out
|
| 38 |
|
| 39 |
+
@st.cache(suppress_st_warning=True, allow_output_mutation=True)
|
| 40 |
def load_bert():
|
| 41 |
model = BERTClass(bert_path='bert_pretrained')
|
| 42 |
model.load_state_dict(torch.load('bert_pretrained.pt'))
|
|
|
|
| 83 |
return out
|
| 84 |
|
| 85 |
|
| 86 |
+
@st.cache(suppress_st_warning=True, allow_output_mutation=True)
|
| 87 |
def load_tiny_bert():
|
| 88 |
model = TinyBERTClass(path = 'tiny_bert_pretrained')
|
| 89 |
model.load_state_dict(torch.load('tiny_bert.pt'))
|
bert_pretrained.pt
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 441192617
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:054376ff0ce0e179be7a13ca753df127732604e7e3c530fbed227be4214de814
|
| 3 |
size 441192617
|