File size: 723 Bytes
67448d5
8e65c11
bc75555
8e65c11
 
67448d5
8dbce5c
8e65c11
 
bc75555
6372def
8e65c11
 
 
 
8dbce5c
 
67448d5
6372def
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.")