Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -13,9 +13,9 @@ def img2text(image):
|
|
13 |
# Function to generate a story based on the caption
|
14 |
def text2story(text):
|
15 |
# Load the text generation model
|
16 |
-
story_model = pipeline("text-generation", model="
|
17 |
# Generate a story based on the input text
|
18 |
-
story_text = story_model(f"Once upon a time, {text}.", max_length=100, num_return_sequences=1)
|
19 |
return story_text[0]["generated_text"] # Return the generated story
|
20 |
|
21 |
# Function to convert text to audio
|
|
|
13 |
# Function to generate a story based on the caption
|
14 |
def text2story(text):
|
15 |
# Load the text generation model
|
16 |
+
story_model = pipeline("text-generation", model="gpt2")
|
17 |
# Generate a story based on the input text
|
18 |
+
story_text = story_model(f"Once upon a time, {text}.", max_length=100, num_return_sequences=1, do_sample=True, top_k=50)
|
19 |
return story_text[0]["generated_text"] # Return the generated story
|
20 |
|
21 |
# Function to convert text to audio
|