jcarbonnell commited on
Commit
b938b9c
1 Parent(s): 1cda371

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -12
app.py CHANGED
@@ -1,15 +1,11 @@
1
  import streamlit as st
2
- import torch
3
- from transformers import GPT2Tokenizer, GPT2LMHeadModel
4
- from summarizer import Summarizer
5
 
6
- model=GPT2LMHeadModel.from_pretrained("DemocracyStudio/generate_nft_content")
7
- tokenizer=GPT2Tokenizer.from_pretrained("DemocracyStudio/generate_nft_content")
8
- summarize=Summarizer()
9
 
10
- device = torch.device("cuda")
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,