|
import streamlit as st |
|
from transformers import pipeline |
|
|
|
|
|
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: |
|
|
|
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.") |
|
|