txt2txt_fla_t5 / app.py
raul-padua's picture
Create app.py
1e97e7e verified
raw
history blame
869 Bytes
import streamlit as st
from transformers import pipeline
# Initialize the pipeline
pipe = pipeline("text2text-generation", model="google/flan-t5-base")
# Title of the app
st.title("Text-to-Text Generation with Google FLAN-T5")
# Text input for the user
input_text = st.text_area("Enter your text here:")
# Button to generate text
if st.button("Generate"):
if input_text:
# Generate text using the pipeline
output = pipe(input_text)
# Display the generated text
st.write("Generated Text:")
st.write(output[0]['generated_text'])
else:
st.write("Please enter some text to generate.")
# Additional information
st.markdown("""
This app uses the Google FLAN-T5 model to generate text based on the input provided.
Simply enter your text in the input box above and click on 'Generate' to see the output.
""")