Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
CHANGED
@@ -30,19 +30,22 @@ with tab1:
|
|
30 |
with open("sample.txt", "r") as text_file:
|
31 |
sample_text = text_file.read()
|
32 |
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
questionInput = ""
|
37 |
|
38 |
-
|
39 |
-
|
40 |
|
|
|
41 |
if example:
|
42 |
-
|
43 |
-
|
44 |
|
45 |
-
|
|
|
|
|
|
|
46 |
button = st.button("Get answer")
|
47 |
if button:
|
48 |
with st.spinner(text="Loading question model..."):
|
|
|
30 |
with open("sample.txt", "r") as text_file:
|
31 |
sample_text = text_file.read()
|
32 |
|
33 |
+
# Get the initial values of context and question
|
34 |
+
context = st.session_state.get("contextInput", "")
|
35 |
+
question = st.session_state.get("questionInput", "")
|
|
|
36 |
|
37 |
+
# Button to try the example
|
38 |
+
example = st.button("Try example")
|
39 |
|
40 |
+
# Update the values if the "Try example" button is clicked
|
41 |
if example:
|
42 |
+
context = sample_text
|
43 |
+
question = sample_question
|
44 |
|
45 |
+
# Display the text area and text input with the updated or default values
|
46 |
+
context = st.text_area("Enter the essay below:", value=context, key="contextInput", height=330)
|
47 |
+
question = st.text_input(label="Enter the question: ", value=question, key="questionInput")
|
48 |
+
|
49 |
button = st.button("Get answer")
|
50 |
if button:
|
51 |
with st.spinner(text="Loading question model..."):
|