Update app.py
Browse files
app.py
CHANGED
@@ -13,13 +13,8 @@ def generate_caption(image_file):
|
|
13 |
return caption
|
14 |
|
15 |
def generate_story(caption):
|
16 |
-
story_generator = pipeline("text-generation", model="Qwen/
|
17 |
-
messages =
|
18 |
-
{
|
19 |
-
"role": "user",
|
20 |
-
"content": f"Please based on following image caption: '{caption}', generate a complete fairy tale story for children with at least 100 words and max 300 words"
|
21 |
-
}
|
22 |
-
]
|
23 |
result = story_generator(messages, max_length=300, num_return_sequences=1)
|
24 |
story = result[0]['generated_text']
|
25 |
return story
|
|
|
13 |
return caption
|
14 |
|
15 |
def generate_story(caption):
|
16 |
+
story_generator = pipeline("text-generation", model="Qwen/Qwen2-1.5B")
|
17 |
+
messages = "Please based on following image caption: "+caption+", generate a complete fairy tale story for children with at least 100 words and max 300 words"
|
|
|
|
|
|
|
|
|
|
|
18 |
result = story_generator(messages, max_length=300, num_return_sequences=1)
|
19 |
story = result[0]['generated_text']
|
20 |
return story
|