smtsead commited on
Commit
0daac1d
·
verified ·
1 Parent(s): e282e9c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -3
app.py CHANGED
@@ -37,10 +37,10 @@ def text2story(text):
37
  str: Generated superhero story suitable for kids aged 3-10, within 100 words.
38
  """
39
  # Load the text generation model
40
- story_generator = pipeline("text-generation", model="pranavpsv/gpt2-genre-story-generator")
41
 
42
  # Generate the story with the superhero genre
43
- prompt = f"<BOS> <superhero> {text}"
44
  story = story_generator(prompt, max_length=100, num_return_sequences=1)[0]['generated_text']
45
 
46
  # Remove <BOS> and <superhero> tags from the generated story
@@ -94,7 +94,7 @@ if uploaded_file is not None:
94
  file.write(bytes_data)
95
 
96
  # Display the uploaded image
97
- st.image(uploaded_file, caption="Your awesome picture!", use_column_width=True)
98
 
99
  # Stage 1: Image to Text
100
  st.text('✨ Turning your picture into words...')
 
37
  str: Generated superhero story suitable for kids aged 3-10, within 100 words.
38
  """
39
  # Load the text generation model
40
+ story_generator = pipeline("text-generation", model="pranavpsv/genre-story-generator-v2")
41
 
42
  # Generate the story with the superhero genre
43
+ prompt = f"{text}"
44
  story = story_generator(prompt, max_length=100, num_return_sequences=1)[0]['generated_text']
45
 
46
  # Remove <BOS> and <superhero> tags from the generated story
 
94
  file.write(bytes_data)
95
 
96
  # Display the uploaded image
97
+ st.image(uploaded_file, caption="Your awesome picture!", use_container_width=True)
98
 
99
  # Stage 1: Image to Text
100
  st.text('✨ Turning your picture into words...')