Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -3,6 +3,7 @@ import torch
|
|
3 |
import tokenizers
|
4 |
import streamlit as st
|
5 |
import re
|
|
|
6 |
|
7 |
|
8 |
@st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, tokenizers.AddedToken: lambda _: None, re.Pattern: lambda _: None}, allow_output_mutation=True, suppress_st_warning=True)
|
@@ -32,18 +33,21 @@ def predict(text, model, tokenizer, n_beams=5, temperature=2.5, top_p=0.8, max_l
|
|
32 |
|
33 |
model, tokenizer = get_model('sberbank-ai/rugpt3medium_based_on_gpt2', 'korzh-medium_30epochs_1bs.bin')
|
34 |
|
35 |
-
st.title("NeuroKorzh")
|
36 |
-
st.markdown("<img width=400px src='https://the-flow.ru/uploads/images/resize/830x0/adaptiveResize/05/06/06/42/25/8c7405840cd7.jpg'>",
|
37 |
-
|
|
|
|
|
38 |
|
39 |
st.markdown("\n")
|
40 |
|
41 |
-
text = st.
|
42 |
button = st.button('Go')
|
43 |
|
44 |
if button:
|
45 |
#try:
|
46 |
-
|
|
|
47 |
|
48 |
#st.subheader('Max Korzh:')
|
49 |
#lines = result.split('\n')
|
@@ -54,4 +58,4 @@ if button:
|
|
54 |
st.write(lines)
|
55 |
|
56 |
#except Exception:
|
57 |
-
# st.error("Ooooops, something went wrong. Try again please and report to me, tg: @vladyur")
|
|
|
3 |
import tokenizers
|
4 |
import streamlit as st
|
5 |
import re
|
6 |
+
from PIL import Image
|
7 |
|
8 |
|
9 |
@st.cache(hash_funcs={tokenizers.Tokenizer: lambda _: None, tokenizers.AddedToken: lambda _: None, re.Pattern: lambda _: None}, allow_output_mutation=True, suppress_st_warning=True)
|
|
|
33 |
|
34 |
model, tokenizer = get_model('sberbank-ai/rugpt3medium_based_on_gpt2', 'korzh-medium_30epochs_1bs.bin')
|
35 |
|
36 |
+
# st.title("NeuroKorzh")
|
37 |
+
# st.markdown("<img width=400px src='https://the-flow.ru/uploads/images/resize/830x0/adaptiveResize/05/06/06/42/25/8c7405840cd7.jpg'>",
|
38 |
+
# unsafe_allow_html=True)
|
39 |
+
image = Image.open('korzh.jpg')
|
40 |
+
st.image(image, caption='NeuroKorzh')
|
41 |
|
42 |
st.markdown("\n")
|
43 |
|
44 |
+
text = st.text_input('Starting point for text generation', 'Что делать, Макс?', height=100)
|
45 |
button = st.button('Go')
|
46 |
|
47 |
if button:
|
48 |
#try:
|
49 |
+
with st.spinner("Generation in progress"):
|
50 |
+
result = predict(text, model, tokenizer)
|
51 |
|
52 |
#st.subheader('Max Korzh:')
|
53 |
#lines = result.split('\n')
|
|
|
58 |
st.write(lines)
|
59 |
|
60 |
#except Exception:
|
61 |
+
# st.error("Ooooops, something went wrong. Try again please and report to me, tg: @vladyur")
|