Text2Text / app.py
mkoot007's picture
Update app.py
8e65c11
raw
history blame
No virus
723 Bytes
import streamlit as st
from transformers import pipeline
# Create a text2text-generation pipeline with the "google/flan-t5-base" model
paraphrase_generator = pipeline("text2text-generation", model="google/flan-t5-base")
st.title("Paraphrase Generator")
user_input = st.text_input("Enter a line:")
if st.button("Generate Paraphrase"):
if user_input:
# Use a prompt to control the paraphrasing
paraphrase_prompt = f"Paraphrase the following line: '{user_input}'"
paraphrase = paraphrase_generator(paraphrase_prompt, max_length=100, do_sample=True)[0]["generated_text"]
st.markdown("**Paraphrase:**")
st.markdown(paraphrase)
else:
st.warning("Please enter a line.")