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

Single document approach

Browse files
Files changed (1) hide show
  1. app.py +14 -13
app.py CHANGED
@@ -98,19 +98,20 @@ def highlight_edits():
98
  import html
99
  prompt = get_prompt(include_generation_options=False)
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
 
 
98
  import html
99
  prompt = get_prompt(include_generation_options=False)
100
  st.write("Prompt:", prompt)
101
+ doc = st.session_state.get('doc', "")
102
+ if doc:
103
+ st.write("Generating suggestions based on the following document:")
104
+ st.write(doc)
105
+ else:
106
+ st.write("Enter a document to see suggestions.")
107
+ updated_doc = st.text_area(
108
+ "Document",
109
+ "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.",
110
+ height=300, key='updated_doc',
111
+ )
112
+ def save_document():
113
+ st.session_state['doc'] = updated_doc
114
+ st.button("Save document", on_click=save_document)
115
 
116
  spans = get_highlights(prompt, doc, updated_doc)
117