kcarnold commited on
Commit
aae2ec9
·
1 Parent(s): bb22056

Always start off updated doc with original doc

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -100,9 +100,17 @@ def highlight_edits():
100
  st.write("Prompt:", prompt)
101
  cols = st.columns(2)
102
  with cols[0]:
103
- doc = st.text_area("Document", "Deep learning neural network technology advances are pretty cool if you are careful to use it in ways that don't take stuff from people.", height=300)
 
 
 
 
 
 
 
 
104
  with cols[1]:
105
- updated_doc = st.text_area("Updated Doc", placeholder="Your edited document. Leave this blank to use your original document.", height=300)
106
 
107
  spans = get_highlights(prompt, doc, updated_doc)
108
 
 
100
  st.write("Prompt:", prompt)
101
  cols = st.columns(2)
102
  with cols[0]:
103
+ def on_doc_change():
104
+ """Set the updated_doc to start with the original doc."""
105
+ st.session_state['updated_doc'] = st.session_state['doc']
106
+ doc = st.text_area(
107
+ "Document",
108
+ "Deep learning neural network technology advances are pretty cool if you are careful to use it in ways that don't take stuff from people.",
109
+ height=300, key='doc',
110
+ on_change=on_doc_change
111
+ )
112
  with cols[1]:
113
+ updated_doc = st.text_area("Updated Doc", placeholder="Your edited document. Leave this blank to use your original document.", height=300, key='updated_doc')
114
 
115
  spans = get_highlights(prompt, doc, updated_doc)
116