|
import streamlit as st |
|
from transformers import pipeline, set_seed |
|
|
|
pipe = pipeline("text-generation", model="google/flan-t5-base") |
|
|
|
st.title("Paraphrase Generator") |
|
user_word = st.text_input("Enter a line:") |
|
|
|
if st.button("Generate Paraphrase"): |
|
if user_word: |
|
paraphrase_prompt= f"Write a Paraphrase on '{user_word}'.\n" |
|
set_seed(42) |
|
paraphrase = pipe(paraphrase_prompt, max_length=100, do_sample=True, num_return_sequences=1)[0]["generated_text"] |
|
st.markdown("**Paraphrase:**") |
|
st.markdown(paraphrase) |
|
else: |
|
st.warning("Please enter a line.") |
|
|