File size: 1,526 Bytes
bd9a64a
8277b84
bd9a64a
fccc3c5
8277b84
1cda371
150d813
bd9a64a
150d813
a4c9483
150d813
 
e23b19b
bd9a64a
150d813
3b22366
4a98f1a
bd9a64a
056a08f
69ebead
 
425d3bb
ee86f7f
8277b84
 
150d813
dd700b9
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
28
import streamlit as st
from transformers import pipeline, GPT2LMHeadModel, AutoTokenizer#, SummarizationPipeline, AutoModelWithLMHead

generate = pipeline(task='text-generation', model=GPT2LMHeadModel.from_pretrained("DemocracyStudio/generate_nft_content"), tokenizer=AutoTokenizer.from_pretrained("DemocracyStudio/generate_nft_content"))
#summarize = SummarizationPipeline(model=AutoModelWithLMHead.from_pretrained("SEBIS/code_trans_t5_small_program_synthese_transfer_learning_finetune"),tokenizer=AutoTokenizer.from_pretrained("SEBIS/code_trans_t5_small_program_synthese_transfer_learning_finetune", skip_special_tokens=True),device=0)

st.title("Text generation for the marketing content of NFTs")
    
st.sidebar.image("bayc crown.png", use_column_width=True)
st.sidebar.write("image credits: bayc")
topics=["NFT", "Blockchain", "Metaverse"]
choice = st.sidebar.selectbox("Select one topic", topics)
st.sidebar.write("Course project 'NLP with transformers' at opencampus.sh, Spring 2022")
    
if choice == 'NFT':
    manual_input = st.text_area("Manual input: (optional)")
    #num_sequences = st.text_area("Number of sequences: (default: 1)")

    if st.button("Generate"):
        #st.text("Keywords: {}\n".format(keywords))
        #st.text("Length in number of words: {}\n".format(length))
        generated = generate(manual_input, max_length = 512, num_return_sequences=1)
        st.write(generated)
        #tweet = summarize(generated)
        #st.write(tweet)
else:
    st.write("Topic not available yet")