panchadip commited on
Commit
7a237cf
·
verified ·
1 Parent(s): 6441210

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -5,19 +5,19 @@ from transformers import pipeline
5
  generator = pipeline("text-generation", model="gpt2")
6
 
7
  # Streamlit app layout
8
- st.title("AI Story Generator - Creativista ")
9
 
10
  # Prompt input from the user
11
- prompt = st.text_input("Enter a prompt:", "")
12
 
13
- # Slider to control the length of the generated story
14
- max_length = st.slider("Select the maximum length of the story (in words):",
15
  min_value=50, max_value=500, value=100, step=10)
16
 
17
  # Button to trigger the story generation
18
  if st.button("Generate Story"):
19
  if prompt:
20
- # Generate the story based on the prompt
21
  result = generator(prompt, max_length=max_length, num_return_sequences=1)
22
  # Display the generated story
23
  st.write(result[0]['generated_text'])
 
5
  generator = pipeline("text-generation", model="gpt2")
6
 
7
  # Streamlit app layout
8
+ st.title("AI Story Generator")
9
 
10
  # Prompt input from the user
11
+ prompt = st.text_input("Enter a prompt:")
12
 
13
+ # Slider to control the maximum length of the generated story
14
+ max_length = st.slider("Select the maximum length of the story:",
15
  min_value=50, max_value=500, value=100, step=10)
16
 
17
  # Button to trigger the story generation
18
  if st.button("Generate Story"):
19
  if prompt:
20
+ # Generate the story based on the prompt and slider value
21
  result = generator(prompt, max_length=max_length, num_return_sequences=1)
22
  # Display the generated story
23
  st.write(result[0]['generated_text'])