File size: 1,229 Bytes
bd9a64a
fccc3c5
b938b9c
bd9a64a
fccc3c5
b938b9c
1cda371
150d813
 
bd9a64a
150d813
 
 
bd9a64a
150d813
9e9f324
 
bd9a64a
056a08f
69ebead
 
f0873f9
ecd776b
ffca0f8
150d813
056a08f
bd9a64a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import streamlit as st
from transformers import pipeline, GPT2LMHeadModel, AutoTokenizer
#from summarizer import Summarizer

generate = pipeline(task='text-generation', model=GPT2LMHeadModel.from_pretrained("DemocracyStudio/generate_nft_content"), tokenizer=AutoTokenizer.from_pretrained("DemocracyStudio/generate_nft_content"))
#summarize=Summarizer()

st.title("Text generation for the marketing content of NFTs")
st.subheader("Course project 'NLP with transformers' at opencampus.sh, Spring 2022")
    
st.sidebar.image("bayc crown.png", use_column_width=True)
topics=["NFT", "Blockchain", "Metaverse"]
choice = st.sidebar.selectbox("Select one topic", topics)
    
if choice == 'NFT':
    keywords=st.text_area("Input keywords here: (optional)")
    length=st.text_area("How long do you want your text to be? (default: 512 words)")

    if st.button("Generate"):
        #st.text("Keywords: {}\n".format(keywords))
        #st.text("Length in number of words: {}\n".format(length))
        st.text(generate("", num_return_sequences=1))
        #summary = summarize(generated_text, num_sentences=1)
        #st.text("This is a tweet-sized summary of your article: ", summary)
else:
    st.write("Topic not available yet")