jcarbonnell's picture
Update app.py
4a98f1a
raw
history blame
1.25 kB
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':
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, num_return_sequences=1)
st.text(generated)
#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")