jcarbonnell commited on
Commit
8e7bf1e
1 Parent(s): ee86f7f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -1,8 +1,9 @@
1
  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 = pipeline(task='summarization', device=0)
 
6
 
7
  st.title("Text generation for the marketing content of NFTs")
8
 
@@ -20,7 +21,7 @@ if choice == 'NFT':
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")
 
1
  import streamlit as st
2
+ from transformers import pipeline, GPT2LMHeadModel, AutoTokenizer, SummarizationPipeline, AutoModelWithLMHead
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 = SummarizationPipeline(model=AutoModelWithLMHead.from_pretrained("SEBIS/code_trans_t5_small_program_synthese_transfer_learning_finetune"),
6
+ tokenizer=AutoTokenizer.from_pretrained("SEBIS/code_trans_t5_small_program_synthese_transfer_learning_finetune", skip_special_tokens=True),device=0)
7
 
8
  st.title("Text generation for the marketing content of NFTs")
9
 
 
21
  #st.text("Length in number of words: {}\n".format(length))
22
  generated = generate(manual_input, max_length = 512, num_return_sequences=1)
23
  st.write(generated)
24
+ tweet = summarize(generated)
25
  st.write(tweet)
26
  else:
27
  st.write("Topic not available yet")