Spaces:
Sleeping
Sleeping
Annaamalai
commited on
Commit
•
25b33a6
1
Parent(s):
7118c97
Update app.py
Browse files
app.py
CHANGED
@@ -7,10 +7,10 @@ model = pipeline("text-generation")
|
|
7 |
# Streamlit app
|
8 |
def main():
|
9 |
st.title("Cherry Bot")
|
10 |
-
st.markdown("*Your
|
11 |
|
12 |
-
#
|
13 |
-
|
14 |
|
15 |
# Add a sidebar to the app
|
16 |
with st.sidebar:
|
@@ -18,21 +18,18 @@ def main():
|
|
18 |
# Slider for adjusting the maximum length of generated text
|
19 |
max_length = st.slider("Max Length of Generated Text:", min_value=10, max_value=200, value=50, step=10)
|
20 |
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
# Display the generated text
|
34 |
-
st.write("Generated Text:")
|
35 |
-
st.write(generated_text)
|
36 |
|
37 |
if __name__ == "__main__":
|
38 |
main()
|
|
|
7 |
# Streamlit app
|
8 |
def main():
|
9 |
st.title("Cherry Bot")
|
10 |
+
st.markdown("*Your Companion for Suicide Prevention*")
|
11 |
|
12 |
+
# Add tabs for each chat in the sidebar
|
13 |
+
chat_tabs = st.sidebar.radio("Chats", ["Chat 1", "Chat 2", "Chat 3"])
|
14 |
|
15 |
# Add a sidebar to the app
|
16 |
with st.sidebar:
|
|
|
18 |
# Slider for adjusting the maximum length of generated text
|
19 |
max_length = st.slider("Max Length of Generated Text:", min_value=10, max_value=200, value=50, step=10)
|
20 |
|
21 |
+
# Text input for user to input starting text for generation
|
22 |
+
starting_text = st.text_area(f"Enter starting text for {chat_tabs}:", height=100)
|
23 |
+
|
24 |
+
# Perform text generation when the user clicks the button
|
25 |
+
if st.button("Generate Text"):
|
26 |
+
if starting_text:
|
27 |
+
# Generate text using the loaded model
|
28 |
+
generated_text = model(starting_text, max_length=max_length)[0]['generated_text']
|
29 |
+
|
30 |
+
# Display the generated text
|
31 |
+
st.write("Generated Text:")
|
32 |
+
st.write(generated_text)
|
|
|
|
|
|
|
33 |
|
34 |
if __name__ == "__main__":
|
35 |
main()
|