lewispons commited on
Commit
248ed64
·
1 Parent(s): 58553e2

Feat: Added logic for random prompts

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -25,16 +25,11 @@ def folder_exists(folder_path):
25
  return False
26
 
27
 
28
- def get_random_requests(user_requests_dict, num_elements=5):
29
- result_list = []
30
- keys = list(user_requests_dict.keys())
31
-
32
- for _ in range(num_elements):
33
- random_key = choice(keys)
34
- random_value = choice(user_requests_dict[random_key])
35
- result_list.append([random_key, random_value])
36
-
37
- return result_list
38
 
39
  def generate_html_table(random_requests):
40
  # Start building the HTML table
@@ -123,7 +118,7 @@ if app_mode == "Generate Recomendations":
123
 
124
  st.subheader("Examples")
125
  with st.container():
126
- examples = get_random_requests(user_requests_tests)
127
  html_table = generate_html_table(examples)
128
  st.write(html_table, unsafe_allow_html=True)
129
  st.divider()
 
25
  return False
26
 
27
 
28
+ def get_random_prompts(examples):
29
+ random_examples = []
30
+ for k in examples.keys():
31
+ random_examples.append([k, choice(examples[k])])
32
+ return random_examples
 
 
 
 
 
33
 
34
  def generate_html_table(random_requests):
35
  # Start building the HTML table
 
118
 
119
  st.subheader("Examples")
120
  with st.container():
121
+ examples = get_random_prompts(user_requests_tests)
122
  html_table = generate_html_table(examples)
123
  st.write(html_table, unsafe_allow_html=True)
124
  st.divider()