Spaces:
Sleeping
Sleeping
Leo Liu
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -10,14 +10,14 @@ def img2text(url):
|
|
10 |
return text
|
11 |
|
12 |
# text2story
|
13 |
-
story_prompt = (
|
14 |
-
f"You are an expert in storytelling for children ages 3-10."
|
15 |
-
f"Based on the image description below:{text}\n"
|
16 |
-
f"Please create a funny, heartwarming, imaginative fairy tale of no less than 50 words"
|
17 |
-
f"Output only the body of the story, do not include other content"
|
18 |
-
)
|
19 |
-
|
20 |
def text2story(text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
story_text = pipeline("text-generation", model="distilbert/distilgpt2",
|
22 |
max_length=200,
|
23 |
do_sample=True,
|
|
|
10 |
return text
|
11 |
|
12 |
# text2story
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
def text2story(text):
|
14 |
+
story_prompt = (
|
15 |
+
f"You are an expert in storytelling for children ages 3-10."
|
16 |
+
f"Based on the image description below:{text}\n"
|
17 |
+
f"Please create a funny, heartwarming, imaginative fairy tale of no less than 50 words"
|
18 |
+
f"Output only the body of the story, do not include other content"
|
19 |
+
)
|
20 |
+
|
21 |
story_text = pipeline("text-generation", model="distilbert/distilgpt2",
|
22 |
max_length=200,
|
23 |
do_sample=True,
|