Spaces:
Runtime error
Runtime error
alirani
commited on
Commit
β’
ff377ee
1
Parent(s):
5e605db
feat: add pre-synopsis
Browse files
app.py
CHANGED
@@ -70,14 +70,31 @@ elif functionality == "Generation":
|
|
70 |
placeholder="Select genres..."
|
71 |
)
|
72 |
|
73 |
-
|
74 |
|
75 |
-
if
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
else:
|
83 |
st.write("Select a functionality ! π")
|
|
|
70 |
placeholder="Select genres..."
|
71 |
)
|
72 |
|
73 |
+
complete_synopsis = st.toggle('Synopsis completion')
|
74 |
|
75 |
+
if complete_synopsis:
|
76 |
+
|
77 |
+
pre_synopsis = st.text_area('Type the beginning of your synopsis')
|
78 |
+
|
79 |
+
button_synopsis = st.button('Get synopsis')
|
80 |
+
|
81 |
+
if button_synopsis:
|
82 |
+
if (len(prod_title.split(' ')) > 0) & option_genres:
|
83 |
+
gen_synopsis = generate_synopsis(model_gen, tokenizer_gen, f"{prod_title} | {option_genres} | {pre_synopsis}")
|
84 |
+
st.text_area('Generated synopsis', value=gen_synopsis, disabled=True)
|
85 |
+
else:
|
86 |
+
st.write('Write a title & select a genre for the generator to work !')
|
87 |
+
|
88 |
+
else:
|
89 |
+
|
90 |
+
button_synopsis = st.button('Get synopsis')
|
91 |
+
|
92 |
+
if button_synopsis:
|
93 |
+
if len(prod_title.split(' ')) > 0:
|
94 |
+
gen_synopsis = generate_synopsis(model_gen, tokenizer_gen, f"{prod_title} | {option_genres} | ")
|
95 |
+
st.text_area('Generated synopsis', value=gen_synopsis, disabled=True)
|
96 |
+
else:
|
97 |
+
st.write('Write a title for the generator to work !')
|
98 |
|
99 |
else:
|
100 |
st.write("Select a functionality ! π")
|