jcarbonnell commited on
Commit
ee86f7f
1 Parent(s): 07ca230

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -5
app.py CHANGED
@@ -2,7 +2,7 @@ import streamlit as st
2
  from transformers import pipeline, GPT2LMHeadModel, AutoTokenizer, BartForConditionalGeneration
3
 
4
  generate = pipeline(task='text-generation', model=GPT2LMHeadModel.from_pretrained("DemocracyStudio/generate_nft_content"), tokenizer=AutoTokenizer.from_pretrained("DemocracyStudio/generate_nft_content"))
5
- summarize=BartForConditionalGeneration.from_pretrained("sshleifer/distilbart-cnn-12-6")
6
 
7
  st.title("Text generation for the marketing content of NFTs")
8
 
@@ -19,10 +19,9 @@ if choice == 'NFT':
19
  #st.text("Keywords: {}\n".format(keywords))
20
  #st.text("Length in number of words: {}\n".format(length))
21
  generated = generate(manual_input, max_length = 512, num_return_sequences=1)
22
- st.write(generated[0])
23
- for k,v in generated[0].items():
24
- tweet = summarize(v)
25
- st.write(v)
26
  else:
27
  st.write("Topic not available yet")
28
 
 
2
  from transformers import pipeline, GPT2LMHeadModel, AutoTokenizer, BartForConditionalGeneration
3
 
4
  generate = pipeline(task='text-generation', model=GPT2LMHeadModel.from_pretrained("DemocracyStudio/generate_nft_content"), tokenizer=AutoTokenizer.from_pretrained("DemocracyStudio/generate_nft_content"))
5
+ summarize = pipeline(task='summarization', device=0)
6
 
7
  st.title("Text generation for the marketing content of NFTs")
8
 
 
19
  #st.text("Keywords: {}\n".format(keywords))
20
  #st.text("Length in number of words: {}\n".format(length))
21
  generated = generate(manual_input, max_length = 512, num_return_sequences=1)
22
+ st.write(generated)
23
+ tweet = summarize(generated[0])
24
+ st.write(tweet)
 
25
  else:
26
  st.write("Topic not available yet")
27