Leo Liu commited on
Commit
7294266
·
verified ·
1 Parent(s): 049010c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -8
app.py CHANGED
@@ -15,14 +15,20 @@ def img2text(url):
15
 
16
  # text2story
17
  def text2story(text):
18
-
19
- child_prompt = f"Generate a children's story based on: {text}"
20
-
21
- pipe = pipeline("text-generation", model="pranavpsv/genre-story-generator-v2")
22
-
23
- story_text = pipe(child_prompt,
24
- max_length=150,
25
- num_return_sequences=1)[0]['generated_text']
 
 
 
 
 
 
26
  return story_text
27
 
28
 
 
15
 
16
  # text2story
17
  def text2story(text):
18
+ pipe = pipeline(
19
+ "text-generation",
20
+ model="pranavpsv/genre-story-generator-v2",
21
+ max_new_tokens=300,
22
+ min_new_tokens=100,
23
+ do_sample=True,
24
+ temperature=0.65,
25
+ top_p=0.85,
26
+ top_k=30,
27
+ repetition_penalty=1.3,
28
+ no_repeat_ngram_size=3,
29
+ early_stopping=False
30
+ )
31
+ story_text = pipe(text, return_full_text=False)[0]['generated_text']
32
  return story_text
33
 
34