Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -12,7 +12,7 @@ def load_models():
|
|
| 12 |
"""Load all models and cache them for faster execution"""
|
| 13 |
models = {
|
| 14 |
"image_captioner": pipeline("image-to-text", model="sooh-j/blip-image-captioning-base"),
|
| 15 |
-
"story_generator": pipeline("text-generation", model="
|
| 16 |
}
|
| 17 |
return models
|
| 18 |
|
|
@@ -49,9 +49,9 @@ 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
|
| 53 |
"<|user|>\n"
|
| 54 |
-
f"Please generate a short story within 100 words that clearly utilizes the following image caption and expands upon it
|
| 55 |
"<|assistant|>"
|
| 56 |
)
|
| 57 |
|
|
|
|
| 12 |
"""Load all models and cache them for faster execution"""
|
| 13 |
models = {
|
| 14 |
"image_captioner": pipeline("image-to-text", model="sooh-j/blip-image-captioning-base"),
|
| 15 |
+
"story_generator": pipeline("text-generation", model="trl-internal-testing/tiny-MistralForCausalLM-0.2")
|
| 16 |
}
|
| 17 |
return models
|
| 18 |
|
|
|
|
| 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.\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 with no introduction or closing remarks:\n\"{caption}\"\n"
|
| 55 |
"<|assistant|>"
|
| 56 |
)
|
| 57 |
|