Bey007 commited on
Commit
b0faac5
โ€ข
1 Parent(s): b9cae4e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -13,12 +13,12 @@ emotion_classifier = pipeline("text-classification", model="bhadresh-savani/dist
13
 
14
  # Function to generate a comforting story using the pretrained model
15
  def generate_story(theme):
16
- # Construct a prompt for generating a story based on the user's selected theme
17
- story_prompt = f"Tell a comforting and inspiring story about {theme}. Make it detailed and heartwarming."
18
  input_ids = tokenizer.encode(story_prompt, return_tensors='pt')
19
  story_ids = model.generate(
20
  input_ids,
21
- max_length=350, # Longer story length for richer content
22
  temperature=0.9, # Encourage creative storytelling
23
  repetition_penalty=1.1,
24
  num_return_sequences=1
@@ -28,6 +28,7 @@ def generate_story(theme):
28
  return story
29
 
30
 
 
31
  # Streamlit page configuration
32
  st.set_page_config(page_title="Grief and Loss Support Bot ๐ŸŒฟ", page_icon="๐ŸŒฟ", layout="centered")
33
  st.markdown("<style>.css-1d391kg { background-color: #F3F7F6; }</style>", unsafe_allow_html=True)
 
13
 
14
  # Function to generate a comforting story using the pretrained model
15
  def generate_story(theme):
16
+ # A more detailed prompt for generating a story about courage
17
+ story_prompt = f"Tell me a detailed, comforting, and heartwarming story about {theme}. The story should include a character facing a tough challenge, showing immense courage, and ultimately overcoming it with a positive resolution. Include specific moments of struggle and inspiration."
18
  input_ids = tokenizer.encode(story_prompt, return_tensors='pt')
19
  story_ids = model.generate(
20
  input_ids,
21
+ max_length=500, # Increase length for more detailed content
22
  temperature=0.9, # Encourage creative storytelling
23
  repetition_penalty=1.1,
24
  num_return_sequences=1
 
28
  return story
29
 
30
 
31
+
32
  # Streamlit page configuration
33
  st.set_page_config(page_title="Grief and Loss Support Bot ๐ŸŒฟ", page_icon="๐ŸŒฟ", layout="centered")
34
  st.markdown("<style>.css-1d391kg { background-color: #F3F7F6; }</style>", unsafe_allow_html=True)