Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,9 +54,6 @@ def text2story(text):
|
|
54 |
# Remove <BOS> and <superhero> tags from the generated story
|
55 |
story = story.replace("<BOS>", "").replace("<superhero>", "").strip()
|
56 |
|
57 |
-
# Remove the input text (scenario) from the generated story to avoid redundancy
|
58 |
-
if text in story:
|
59 |
-
story = story.replace(text, "").strip()
|
60 |
|
61 |
# Ensure the story is within 100 words by truncating if necessary
|
62 |
story = " ".join(story.split()[:100])
|
@@ -65,8 +62,6 @@ def text2story(text):
|
|
65 |
if len(story.split()) < 50: # Minimum 50 words
|
66 |
story = story_generator(prompt, max_length=200, num_return_sequences=1)[0]['generated_text']
|
67 |
story = story.replace("<BOS>", "").replace("<superhero>", "").strip()
|
68 |
-
if text in story:
|
69 |
-
story = story.replace(text, "").strip()
|
70 |
story = " ".join(story.split()[:100])
|
71 |
|
72 |
return story
|
|
|
54 |
# Remove <BOS> and <superhero> tags from the generated story
|
55 |
story = story.replace("<BOS>", "").replace("<superhero>", "").strip()
|
56 |
|
|
|
|
|
|
|
57 |
|
58 |
# Ensure the story is within 100 words by truncating if necessary
|
59 |
story = " ".join(story.split()[:100])
|
|
|
62 |
if len(story.split()) < 50: # Minimum 50 words
|
63 |
story = story_generator(prompt, max_length=200, num_return_sequences=1)[0]['generated_text']
|
64 |
story = story.replace("<BOS>", "").replace("<superhero>", "").strip()
|
|
|
|
|
65 |
story = " ".join(story.split()[:100])
|
66 |
|
67 |
return story
|