kcarnold commited on
Commit
d000502
1 Parent(s): e33013a

Include generation options only for rewrite; add a few more.

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -19,13 +19,18 @@ def show_token(token):
19
  return token_display
20
 
21
 
22
- def get_prompt(default="Rewrite this document to be more clear and concise."):
23
  # pick a preset prompt or "other"
 
 
 
 
 
 
24
  with st.popover("Prompt options"):
25
  prompt_options = [
26
  "Rewrite this document to be ...",
27
- "Summarize this document in one sentence.",
28
- "Translate this document into Spanish.",
29
  "Other"
30
  ]
31
  prompt = st.radio("Prompt", prompt_options, help="Instructions for what the bot should do.")
@@ -47,7 +52,7 @@ def get_preds_api(prompt, original_doc, rewrite_in_progress, k=5):
47
  def rewrite_with_predictions():
48
  st.title("Rewrite with Predictive Text")
49
 
50
- prompt = get_prompt()
51
  st.write("Prompt:", prompt)
52
 
53
  cols = st.columns(2)
@@ -88,7 +93,7 @@ def highlight_edits():
88
  st.title("Highlight locations for possible edits")
89
 
90
  import html
91
- prompt = get_prompt()
92
  st.write("Prompt:", prompt)
93
  cols = st.columns(2)
94
  with cols[0]:
 
19
  return token_display
20
 
21
 
22
+ def get_prompt(*, include_generation_options, default="Rewrite this document to be more clear and concise."):
23
  # pick a preset prompt or "other"
24
+ generation_options = [
25
+ "Summarize this document in one sentence.",
26
+ "Translate this document into Spanish.",
27
+ "Write a concise essay according to this outline.",
28
+ "Write a detailed essay according to this outline.",
29
+ ]
30
  with st.popover("Prompt options"):
31
  prompt_options = [
32
  "Rewrite this document to be ...",
33
+ *(generation_options if include_generation_options else []),
 
34
  "Other"
35
  ]
36
  prompt = st.radio("Prompt", prompt_options, help="Instructions for what the bot should do.")
 
52
  def rewrite_with_predictions():
53
  st.title("Rewrite with Predictive Text")
54
 
55
+ prompt = get_prompt(include_generation_options=True)
56
  st.write("Prompt:", prompt)
57
 
58
  cols = st.columns(2)
 
93
  st.title("Highlight locations for possible edits")
94
 
95
  import html
96
+ prompt = get_prompt(include_generation_options=False)
97
  st.write("Prompt:", prompt)
98
  cols = st.columns(2)
99
  with cols[0]: