Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ text_generator = pipeline("text-generation", model="google/flan-t5-base")
|
|
4 |
|
5 |
st.title("Story Generator")
|
6 |
|
7 |
-
|
8 |
title = st.text_input("Title of the Story:")
|
9 |
character = st.text_input("Character (Hero) Name:")
|
10 |
era = st.selectbox("Era of the Story:", ["Medieval", "Modern", "Future"])
|
@@ -14,7 +14,7 @@ ending = st.selectbox("Ending:", ["Happy", "Sad"])
|
|
14 |
if st.button("Generate Story"):
|
15 |
if title and character:
|
16 |
prompt = f"In the {era} era, there was a character named {character}. This is the {genre} story of {character}, a {genre} story with a {ending} ending."
|
17 |
-
|
18 |
story = text_generator(prompt, max_length=300, do_sample=True)[0]["generated_text"]
|
19 |
full_story = f"# {title}\n\n{story}"
|
20 |
|
|
|
4 |
|
5 |
st.title("Story Generator")
|
6 |
|
7 |
+
|
8 |
title = st.text_input("Title of the Story:")
|
9 |
character = st.text_input("Character (Hero) Name:")
|
10 |
era = st.selectbox("Era of the Story:", ["Medieval", "Modern", "Future"])
|
|
|
14 |
if st.button("Generate Story"):
|
15 |
if title and character:
|
16 |
prompt = f"In the {era} era, there was a character named {character}. This is the {genre} story of {character}, a {genre} story with a {ending} ending."
|
17 |
+
set_seed(42)
|
18 |
story = text_generator(prompt, max_length=300, do_sample=True)[0]["generated_text"]
|
19 |
full_story = f"# {title}\n\n{story}"
|
20 |
|