Pablinho commited on
Commit
e951325
1 Parent(s): 7a104a8

Update brain.py

Browse files
Files changed (1) hide show
  1. brain.py +4 -1
brain.py CHANGED
@@ -40,7 +40,10 @@ class StoryGenerator:
40
  """Generate a story using image captioning and language model."""
41
  llm = self.get_llm(model_name)
42
  story = self.prompt_template | llm
43
- return story.invoke(input={"scenario": scenario})
 
 
 
44
 
45
  def generate_story_from_image(self, image, model_name):
46
  """Generate a story from an image."""
 
40
  """Generate a story using image captioning and language model."""
41
  llm = self.get_llm(model_name)
42
  story = self.prompt_template | llm
43
+ generated_story = story.invoke(
44
+ input={"scenario": scenario}
45
+ ).strip().rstrip('</s>').strip()
46
+ return generated_story
47
 
48
  def generate_story_from_image(self, image, model_name):
49
  """Generate a story from an image."""