Update app.py
Browse files
app.py
CHANGED
|
@@ -10,18 +10,17 @@ def img2text(url):
|
|
| 10 |
|
| 11 |
# text2story
|
| 12 |
def text2story(text):
|
| 13 |
-
messages = f"""Generate a story of about 100 words using the following sentences: {text}."""
|
| 14 |
# messages = [
|
| 15 |
# {"role": "system", "content": "You're a chatbot that writes stories based on keywords.The story must contain:Beginning, middle, end,Character development"},
|
| 16 |
# {"role": "user", "content": "Keywords:"+text},
|
| 17 |
#]
|
| 18 |
-
text_to_story_model= pipeline("text-generation", model="
|
| 19 |
story_text = text_to_story_model(
|
| 20 |
-
|
| 21 |
max_length=150,
|
| 22 |
min_length=50,
|
| 23 |
-
do_sample=True,
|
| 24 |
-
#early_stopping=False
|
| 25 |
)[0]['generated_text']
|
| 26 |
return story_text
|
| 27 |
|
|
|
|
| 10 |
|
| 11 |
# text2story
|
| 12 |
def text2story(text):
|
| 13 |
+
#messages = f"""Generate a story of about 100 words using the following sentences: {text}."""
|
| 14 |
# messages = [
|
| 15 |
# {"role": "system", "content": "You're a chatbot that writes stories based on keywords.The story must contain:Beginning, middle, end,Character development"},
|
| 16 |
# {"role": "user", "content": "Keywords:"+text},
|
| 17 |
#]
|
| 18 |
+
text_to_story_model= pipeline("text-generation", model="Tincando/fiction_story_generator")
|
| 19 |
story_text = text_to_story_model(
|
| 20 |
+
text,
|
| 21 |
max_length=150,
|
| 22 |
min_length=50,
|
| 23 |
+
#do_sample=True,
|
|
|
|
| 24 |
)[0]['generated_text']
|
| 25 |
return story_text
|
| 26 |
|