Text2Story / app.py
mkoot007's picture
Create app.py
bec6716
raw
history blame
No virus
754 Bytes
import streamlit as st
from transformers import pipeline
# Create a T5 text2text-generation pipeline
pipe = pipeline("text2text-generation", model="kaist-ai/prometheus-13b-v1.0")
# Define the Streamlit app
st.title("Text Generation App")
# Ask the user for input text
user_input = st.text_area("Enter text:")
# Generate text when the user clicks the button
if st.button("Generate Text"):
if user_input:
# Use the specified pipeline to generate text
generated_text = pipe(user_input, max_length=100, do_sample=True)[0]["generated_text"]
st.write("Generated Text:")
st.write(generated_text)
else:
st.warning("Please enter text.")
# Customize the Streamlit app's appearance and other features as needed.