from gpt_text import init_val import streamlit as st import pandas as pd import numpy as np import matplotlib.pyplot as plt from wordcloud import WordCloud, STOPWORDS # Program to read from text field and plot wordcloud in streamlit app st.title("WordCloud Generator") st.markdown("People who are new to a field can use this to get a quick overview of the field. It can also be used to get a quick summary of keywords in a research paper/article/books.") st.markdown("WordCloud generator creates a image of words from the text you enter. The size of the word depends on the importance of the word in the text.") st.markdown("Huggingface is a free platform to share the apps like this. This helps developers like us to reach more people.") st.subheader("Play with the WordCloud Generator") st.markdown("_Example given below is based on the GPT-1 research paper [1]_") text = st.text_area("Enter text from the Article", placeholder="Type Here ..", height=250, value=init_val) if st.button("Generate WordCloud"): if text == "Type Here ..": st.warning("Please Enter Text") else: wordcloud = WordCloud(min_word_length=3, background_color='White').generate(text) fig, ax = plt.subplots() ax.imshow(wordcloud, interpolation='bilinear') ax.axis("off") st.pyplot(fig) st.subheader("Reference") st.markdown("1. [Radford, A., Narasimhan, K., Salimans, T., & Sutskever, I. (n.d.). (GPT-1) Improving Language Understanding by Generative Pre-Training.](https://s3-us-west-2.amazonaws.com/openai-assets/research-covers/language-unsupervised/language_understanding_paper.pdf)") st.markdown("2. [Wordcloud library](https://pypi.org/project/wordcloud/)")