Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,7 +49,7 @@ def text2story(caption, _models):
|
|
| 49 |
# Updated prompt includes explicit instructions to incorporate details from the caption
|
| 50 |
prompt = (
|
| 51 |
"<|system|>\n"
|
| 52 |
-
"You are a creative story generating assistant that only gives me a happy story based on image caption given, no reply
|
| 53 |
"<|user|>\n"
|
| 54 |
f"Please generate a short story within 100 words that clearly utilizes the following image caption and expands upon it thoroughly:\n\"{caption}\"\n"
|
| 55 |
"<|assistant|>"
|
|
@@ -58,7 +58,7 @@ def text2story(caption, _models):
|
|
| 58 |
# Generate story with parameters tuned for creativity and coherence
|
| 59 |
response = story_generator(
|
| 60 |
prompt,
|
| 61 |
-
max_new_tokens=
|
| 62 |
do_sample=True,
|
| 63 |
temperature=0.7, # Balanced creativity
|
| 64 |
top_p=0.9, # Focus on more likely tokens for coherence
|
|
|
|
| 49 |
# Updated prompt includes explicit instructions to incorporate details from the caption
|
| 50 |
prompt = (
|
| 51 |
"<|system|>\n"
|
| 52 |
+
"You are a creative story generating assistant that only gives me a happy story based on image caption given, no reply or quotation are needed which means that you don't need to answer but just give me the story with no quotation.\n"
|
| 53 |
"<|user|>\n"
|
| 54 |
f"Please generate a short story within 100 words that clearly utilizes the following image caption and expands upon it thoroughly:\n\"{caption}\"\n"
|
| 55 |
"<|assistant|>"
|
|
|
|
| 58 |
# Generate story with parameters tuned for creativity and coherence
|
| 59 |
response = story_generator(
|
| 60 |
prompt,
|
| 61 |
+
max_new_tokens=120, # Enough tokens for a complete story
|
| 62 |
do_sample=True,
|
| 63 |
temperature=0.7, # Balanced creativity
|
| 64 |
top_p=0.9, # Focus on more likely tokens for coherence
|