Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -49,8 +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 always incorporates key details "
|
| 53 |
-
"from the provided image caption into your story.\n"
|
| 54 |
"<|user|>\n"
|
| 55 |
f"Please generate a short story within 100 words that clearly utilizes the following image caption and expands upon it thoroughly:\n\"{caption}\"\n"
|
| 56 |
"<|assistant|>"
|
|
@@ -59,7 +58,7 @@ def text2story(caption, _models):
|
|
| 59 |
# Generate story with parameters tuned for creativity and coherence
|
| 60 |
response = story_generator(
|
| 61 |
prompt,
|
| 62 |
-
max_new_tokens=
|
| 63 |
do_sample=True,
|
| 64 |
temperature=0.7, # Balanced creativity
|
| 65 |
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 always incorporates key details from the provided image caption into your story.\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=100, # 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
|