CR7CAD commited on
Commit
61b9f37
·
verified ·
1 Parent(s): 45f5b70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
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="Qwen/Qwen2-0.5B-Instruct")
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 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|>"
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