Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -10,16 +10,13 @@ def img2text(url):
|
|
10 |
text = image_to_text_model(url)[0]["generated_text"]
|
11 |
return text
|
12 |
|
13 |
-
# Function to convert text to a
|
14 |
def text2story(text):
|
15 |
# Initialize the text generation pipeline
|
16 |
text_generator = pipeline("text-generation", model="distilbert/distilgpt2")
|
17 |
|
18 |
-
#
|
19 |
-
|
20 |
-
|
21 |
-
# Generate the story
|
22 |
-
story = text_generator(prompt, max_length=95, num_return_sequences=1)[0]['generated_text']
|
23 |
|
24 |
return story
|
25 |
|
|
|
10 |
text = image_to_text_model(url)[0]["generated_text"]
|
11 |
return text
|
12 |
|
13 |
+
# Function to convert text to a story
|
14 |
def text2story(text):
|
15 |
# Initialize the text generation pipeline
|
16 |
text_generator = pipeline("text-generation", model="distilbert/distilgpt2")
|
17 |
|
18 |
+
# Generate the story directly from the input text
|
19 |
+
story = text_generator(text, max_length=95, num_return_sequences=1)[0]['generated_text']
|
|
|
|
|
|
|
20 |
|
21 |
return story
|
22 |
|