Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
#
|
17 |
-
story_prompt = f"Tell a comforting and
|
18 |
input_ids = tokenizer.encode(story_prompt, return_tensors='pt')
|
19 |
story_ids = model.generate(
|
20 |
input_ids,
|
21 |
-
max_length=
|
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)
|