File size: 637 Bytes
2f2be53
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import streamlit as st
from models.gpt_MODEL import generate_text


st.title('GPT Text Generation')
prompt_text = st.text_area("Input Text", "Type here...")
length = st.slider("Length of Generated Text", min_value=50, max_value=500, value=200)
temperature = st.slider("Temperature", min_value=0.1, max_value=2.0, value=0.7, step=0.1)
beams = st.slider("Number of Generations", min_value=2, max_value=10, value=4, step=1)

if st.button('Generate Text'):
    with st.spinner('Generating...'):
        generated_text = generate_text(prompt_text, length, temperature, beams)
        st.text_area("Generated Text", generated_text, height=250)