dk-crazydiv commited on
Commit
2b0641b
·
1 Parent(s): a84caa2

Added radio button selection for different prompts

Browse files
Files changed (1) hide show
  1. app.py +13 -3
app.py CHANGED
@@ -9,11 +9,16 @@ co = cohere.Client(os.getenv('COHERE_API_KEY'))
9
  def generate_hashtags(input):
10
  if len(input) == 0:
11
  return None
 
 
 
 
 
12
  response = co.generate(
13
  model='xlarge',
14
- prompt="This program will take a sentence as input and reframe it with positive and growth mindset.\n\n--\nInput: I have a lot of work to do today.\nOutput: I have a lot of work to do today. It's better for me to make a list and break it down into smaller chunks and finish them off one by one.\n--\nInput: I am barely able to lift 10 pound weights.\nOutput: I should exercise more consistently and gradually increase my weight limit. I should also try eating healthy foods.\n--\nInput: {}\nOutput:".format(input.strip()),
15
- max_tokens=80,
16
- temperature=0.8,
17
  k=0,
18
  p=1,
19
  frequency_penalty=0,
@@ -28,6 +33,11 @@ st.title('Positive Reframing Generator')
28
  st.write('''This is a simple **Streamlit** app that generates the input sentence with a positive spin to it''')
29
 
30
  input = st.text_area('Enter your post title caption here', height=100)
 
 
 
 
 
31
  if st.button('Reframe'):
32
  output = generate_hashtags(input)
33
  st.write(output)
 
9
  def generate_hashtags(input):
10
  if len(input) == 0:
11
  return None
12
+
13
+ if category == "positive_affirmation":
14
+ input_prompt = "This program will take a sentence as input and reframe it with positive and growth mindset.\n--\nInput: I have a lot of work to do today.\nOutput: I have a lot of work to do today. It's better for me to make a list and break it down into smaller chunks and finish them off one by one.\n--\nInput: I am barely able to lift 10 pound weights.\nOutput: I should exercise more consistently and gradually increase my weight limit. I should also try eating healthy foods.\n--\nInput: {}\nOutput:".format(input.strip())
15
+ if category == "remove_negations":
16
+ input_prompt = "This program will take a sentence as input and reframe it positively without negations..\n--\nInput: I wouldn’t say I don’t want to go.\nOutput: I would like to go.\n--\nInput: That’s not a bad idea.\nOutput: That is a good idea.\n--\nInput: {}\nOutput:".format(input.strip())
17
  response = co.generate(
18
  model='xlarge',
19
+ prompt=input_prompt,
20
+ max_tokens=100,
21
+ temperature=0.9,
22
  k=0,
23
  p=1,
24
  frequency_penalty=0,
 
33
  st.write('''This is a simple **Streamlit** app that generates the input sentence with a positive spin to it''')
34
 
35
  input = st.text_area('Enter your post title caption here', height=100)
36
+
37
+ category = st.radio(
38
+ "Please select a category",
39
+ ('positive_affirmation', 'remove_negations'))
40
+
41
  if st.button('Reframe'):
42
  output = generate_hashtags(input)
43
  st.write(output)