jcarbonnell commited on
Commit
ecd776b
1 Parent(s): 9e9f324

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -9
app.py CHANGED
@@ -1,11 +1,8 @@
1
  import streamlit as st
2
- import torch
3
- from transformers import AutoTokenizer, AutoModelForCausalLM
4
  #from summarizer import Summarizer
5
 
6
- tokenizer = AutoTokenizer.from_pretrained("DemocracyStudio/generate_nft_content")
7
- model = AutoModelForCausalLM.from_pretrained("DemocracyStudio/generate_nft_content")
8
-
9
  #summarize=Summarizer()
10
 
11
  st.title("Text generation for the marketing content of NFTs")
@@ -20,12 +17,10 @@ if choice == 'NFT':
20
  length=st.text_area("How long do you want your text to be? (default: 512 words)")
21
 
22
  if st.button("Generate"):
23
- generated_text = model("")
24
- #summary = summarize(generated_text, num_sentences=1)
25
-
26
  #st.text("Keywords: {}\n".format(keywords))
27
  #st.text("Length in number of words: {}\n".format(length))
28
- st.text("This is your tailored blog article:", generated_text)
 
29
  #st.text("This is a tweet-sized summary of your article: ", summary)
30
  else:
31
  st.write("Topic not available yet")
 
1
  import streamlit as st
2
+ from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
 
3
  #from summarizer import Summarizer
4
 
5
+ generate = pipeline(task='text-generation', model=AutoModelForCausalLM.from_pretrained("DemocracyStudio/generate_nft_content"), tokenizer=AutoTokenizer.from_pretrained("DemocracyStudio/generate_nft_content"))
 
 
6
  #summarize=Summarizer()
7
 
8
  st.title("Text generation for the marketing content of NFTs")
 
17
  length=st.text_area("How long do you want your text to be? (default: 512 words)")
18
 
19
  if st.button("Generate"):
 
 
 
20
  #st.text("Keywords: {}\n".format(keywords))
21
  #st.text("Length in number of words: {}\n".format(length))
22
+ st.text("This is your tailored blog article:", generate("", num_return_sequences=1))
23
+ #summary = summarize(generated_text, num_sentences=1)
24
  #st.text("This is a tweet-sized summary of your article: ", summary)
25
  else:
26
  st.write("Topic not available yet")