Spaces:
Sleeping
Sleeping
ruslanruslanruslan
commited on
Commit
•
a0b720b
1
Parent(s):
716c18c
errors fixed
Browse files- app.py +1 -15
- pages/Borgesian.py +1 -2
app.py
CHANGED
@@ -2,18 +2,4 @@ import streamlit as st
|
|
2 |
|
3 |
st.title('A multipage application featuring various Natural Language Processing instruments and functions')
|
4 |
|
5 |
-
|
6 |
-
with open(image_file, "rb") as image_file:
|
7 |
-
encoded_string = base64.b64encode(image_file.read())
|
8 |
-
st.markdown(
|
9 |
-
f"""
|
10 |
-
<style>
|
11 |
-
.stApp {{
|
12 |
-
background-image: url(data:image/{"png"};base64,{encoded_string.decode()});
|
13 |
-
background-size: cover
|
14 |
-
}}
|
15 |
-
</style>
|
16 |
-
""",
|
17 |
-
unsafe_allow_html=True
|
18 |
-
)
|
19 |
-
add_bg_from_local('aperiodic.png')
|
|
|
2 |
|
3 |
st.title('A multipage application featuring various Natural Language Processing instruments and functions')
|
4 |
|
5 |
+
st.image('aperiodic.png')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pages/Borgesian.py
CHANGED
@@ -6,11 +6,11 @@ from transformers import GPT2LMHeadModel, GPT2Tokenizer
|
|
6 |
@st.cache_resource
|
7 |
def load_model():
|
8 |
borgesian = GPT2LMHeadModel.from_pretrained('sberbank-ai/rugpt3small_based_on_gpt2', output_attentions = False, output_hidden_states = False)
|
9 |
-
borgesian.load_state_dict(torch.load('borgesian_weights.pt', map_location=torch.device('cpu')))
|
10 |
tokenizer = GPT2Tokenizer.from_pretrained("sberbank-ai/rugpt3small_based_on_gpt2")
|
11 |
return borgesian, tokenizer
|
12 |
|
13 |
borgesian, tokenizer = load_model()
|
|
|
14 |
borgesian.to('cpu')
|
15 |
borgesian.eval()
|
16 |
|
@@ -36,4 +36,3 @@ if st.button("Send"):
|
|
36 |
generate_response(user_input, temperature, length, top_p)
|
37 |
else:
|
38 |
st.warning("Please enter some text.")
|
39 |
-
st.image('penrose_tiling.jpg')
|
|
|
6 |
@st.cache_resource
|
7 |
def load_model():
|
8 |
borgesian = GPT2LMHeadModel.from_pretrained('sberbank-ai/rugpt3small_based_on_gpt2', output_attentions = False, output_hidden_states = False)
|
|
|
9 |
tokenizer = GPT2Tokenizer.from_pretrained("sberbank-ai/rugpt3small_based_on_gpt2")
|
10 |
return borgesian, tokenizer
|
11 |
|
12 |
borgesian, tokenizer = load_model()
|
13 |
+
borgesian.load_state_dict(torch.load('borgesian_weights.pt', map_location=torch.device('cpu')))
|
14 |
borgesian.to('cpu')
|
15 |
borgesian.eval()
|
16 |
|
|
|
36 |
generate_response(user_input, temperature, length, top_p)
|
37 |
else:
|
38 |
st.warning("Please enter some text.")
|
|