Hello Streamlit community,
I created a Text Generation App with streamlit and hugging face.
My question is, is there a way to display long texts (Paragraphs) in streamlit.
Is thera a limit to the length of text we can display on the app as the output from the text generation. the following is my code:
if option == “Text Generation”:
st.subheader("Enter a sentence you want to generate a blog") text = st.text_area("Enter a paragraph", height=150) max_length = st.number_input("Chose the max_length") if st.button("Generate"): generated_text = text_generation(text) st.write(generated_text)
here is the function:
text: data to be enterred
max_len: maximum number of tokens
min_len: minimum number of tokens
max_l = 300
inputs = gen_tokenizer.encode(text, return_tensors=‘pt’)
output = gen_model.generate(inputs, max_length=max_l, num_beams=5, no_repeat_ngram_size=2, early_stopping=True)
blog = gen_tokenizer.decode(output, skip_special_tokens=True)
When I run this code on Jupyter notebook, it runs fully displaying texts. But in streamlit app it just does not show. very limited maybe maximum 100. is there a limit like that or something?
What should I do?