Zekun Wu commited on
Commit
69068d9
β€’
1 Parent(s): f695432
pages/{3_explanation_generation.py β†’ 2_explanation_generation.py} RENAMED
@@ -5,7 +5,7 @@ import os
5
 
6
 
7
  # Function to generate explanations based on a template
8
- def generate_explanations(model_name, questions, template, custom_template=None):
9
  agent = GPTAgent(model_name)
10
  explanations = []
11
  progress_bar = st.progress(0)
@@ -30,7 +30,7 @@ def generate_explanations(model_name, questions, template, custom_template=None)
30
 
31
  Explanation:
32
  """
33
- response = agent.invoke(prompt, temperature=0.8, max_tokens=150).strip()
34
  explanations.append(response)
35
 
36
  # Update progress bar
@@ -106,6 +106,9 @@ else:
106
  template = st.selectbox("Select an explanation template", ["Default", "Chain of Thought", "Custom"])
107
  model_name = st.selectbox('Select a model:', ['gpt4-1106', 'gpt35-1106'])
108
 
 
 
 
109
  custom_template = ""
110
  if template == "Custom":
111
  custom_template = st.text_area("Enter your custom template",
@@ -114,7 +117,7 @@ else:
114
  if st.button('Generate Explanations'):
115
  questions_df = pd.read_csv(uploaded_file_gen)
116
  questions = questions_df['question'].tolist()
117
- explanations = generate_explanations(model_name, questions, template, custom_template)
118
 
119
  result_df_gen = pd.DataFrame({
120
  'question': questions,
 
5
 
6
 
7
  # Function to generate explanations based on a template
8
+ def generate_explanations(model_name, questions, template, temperature, max_tokens, custom_template=None):
9
  agent = GPTAgent(model_name)
10
  explanations = []
11
  progress_bar = st.progress(0)
 
30
 
31
  Explanation:
32
  """
33
+ response = agent.invoke(prompt, temperature=temperature, max_tokens=max_tokens).strip()
34
  explanations.append(response)
35
 
36
  # Update progress bar
 
106
  template = st.selectbox("Select an explanation template", ["Default", "Chain of Thought", "Custom"])
107
  model_name = st.selectbox('Select a model:', ['gpt4-1106', 'gpt35-1106'])
108
 
109
+ temperature = st.sidebar.slider('Temperature', min_value=0.0, max_value=1.0, value=0.8)
110
+ max_tokens = st.sidebar.slider('Max Tokens', min_value=50, max_value=500, value=150)
111
+
112
  custom_template = ""
113
  if template == "Custom":
114
  custom_template = st.text_area("Enter your custom template",
 
117
  if st.button('Generate Explanations'):
118
  questions_df = pd.read_csv(uploaded_file_gen)
119
  questions = questions_df['question'].tolist()
120
+ explanations = generate_explanations(model_name, questions, template, temperature, max_tokens, custom_template)
121
 
122
  result_df_gen = pd.DataFrame({
123
  'question': questions,
pages/{2_batch_evaluation.py β†’ 3_batch_evaluation.py} RENAMED
File without changes