Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,7 +17,7 @@ def generate_full_story(excerpt: str) -> str:
|
|
| 17 |
to generate the complete story that includes Parv, Key Event, Section and the story continuation.
|
| 18 |
"""
|
| 19 |
# Tokenize the user-provided excerpt.
|
| 20 |
-
encoded_input = tokenizer(excerpt, return_tensors="pt")
|
| 21 |
# Move tensors to the appropriate device.
|
| 22 |
encoded_input = {k: v.to(device) for k, v in encoded_input.items()}
|
| 23 |
|
|
@@ -34,7 +34,7 @@ def generate_full_story(excerpt: str) -> str:
|
|
| 34 |
)
|
| 35 |
|
| 36 |
# Decode the generated sequence.
|
| 37 |
-
generated_text = tokenizer.decode(output.sequences[0], skip_special_tokens=True)
|
| 38 |
|
| 39 |
return generated_text
|
| 40 |
|
|
@@ -46,9 +46,9 @@ interface = gr.Interface(
|
|
| 46 |
label = "Incomplete Story Excerpt",
|
| 47 |
placeholder = "Enter your incomplete story excerpt here..."
|
| 48 |
),
|
| 49 |
-
outputs=gr.Textbox(label = "Complete Story with Details"),
|
| 50 |
-
title="Mythology Storyteller",
|
| 51 |
-
description=(
|
| 52 |
"Enter an incomplete story excerpt. "
|
| 53 |
"The model will generate a complete the complete chapter."
|
| 54 |
)
|
|
|
|
| 17 |
to generate the complete story that includes Parv, Key Event, Section and the story continuation.
|
| 18 |
"""
|
| 19 |
# Tokenize the user-provided excerpt.
|
| 20 |
+
encoded_input = tokenizer(excerpt, return_tensors = "pt")
|
| 21 |
# Move tensors to the appropriate device.
|
| 22 |
encoded_input = {k: v.to(device) for k, v in encoded_input.items()}
|
| 23 |
|
|
|
|
| 34 |
)
|
| 35 |
|
| 36 |
# Decode the generated sequence.
|
| 37 |
+
generated_text = tokenizer.decode(output.sequences[0], skip_special_tokens = True)
|
| 38 |
|
| 39 |
return generated_text
|
| 40 |
|
|
|
|
| 46 |
label = "Incomplete Story Excerpt",
|
| 47 |
placeholder = "Enter your incomplete story excerpt here..."
|
| 48 |
),
|
| 49 |
+
outputs = gr.Textbox(label = "Complete Story with Details"),
|
| 50 |
+
title = "🏺 Mythology Storyteller",
|
| 51 |
+
description = (
|
| 52 |
"Enter an incomplete story excerpt. "
|
| 53 |
"The model will generate a complete the complete chapter."
|
| 54 |
)
|