Spaces:
Build error
Build error
jcarbonnell
commited on
Commit
•
b938b9c
1
Parent(s):
1cda371
Update app.py
Browse files
app.py
CHANGED
@@ -1,15 +1,11 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
3 |
-
from
|
4 |
-
from summarizer import Summarizer
|
5 |
|
6 |
-
|
7 |
-
|
8 |
-
summarize=Summarizer()
|
9 |
|
10 |
-
|
11 |
-
model.cuda()
|
12 |
-
model.to(device)
|
13 |
|
14 |
st.title("Text generation for the marketing content of NFTs")
|
15 |
st.subheader("Course project 'NLP with transformers' at opencampus.sh, Spring 2022")
|
@@ -24,9 +20,7 @@ if choice == 'NFT':
|
|
24 |
|
25 |
if st.button("Generate"):
|
26 |
prompt = "<|startoftext|>"
|
27 |
-
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
28 |
-
generated = generated.to(device)
|
29 |
-
|
30 |
sample_outputs = model.generate(
|
31 |
generated,
|
32 |
do_sample=True,
|
|
|
1 |
import streamlit as st
|
2 |
+
from transformers import AutoTokenizer, AutoModelForCausalLM
|
3 |
+
#from summarizer import Summarizer
|
|
|
4 |
|
5 |
+
tokenizer = AutoTokenizer.from_pretrained("DemocracyStudio/generate_nft_content")
|
6 |
+
model = AutoModelForCausalLM.from_pretrained("DemocracyStudio/generate_nft_content")
|
|
|
7 |
|
8 |
+
#summarize=Summarizer()
|
|
|
|
|
9 |
|
10 |
st.title("Text generation for the marketing content of NFTs")
|
11 |
st.subheader("Course project 'NLP with transformers' at opencampus.sh, Spring 2022")
|
|
|
20 |
|
21 |
if st.button("Generate"):
|
22 |
prompt = "<|startoftext|>"
|
23 |
+
generated = torch.tensor(tokenizer.encode(prompt)).unsqueeze(0)
|
|
|
|
|
24 |
sample_outputs = model.generate(
|
25 |
generated,
|
26 |
do_sample=True,
|