Spaces:
Running
Running
App.py: panel discussion update
Browse filesNow possible to choose the panel leader amongst the LLMs and to choose which LLMs are panelists, but are prevented from having no panelist or having the same panelist and panel leader.
app.py
CHANGED
|
@@ -82,15 +82,37 @@ with tab_panel:
|
|
| 82 |
|
| 83 |
temperature = st.text_input("Temperature", value=0.1)
|
| 84 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 85 |
submitted = st.form_submit_button("Submit")
|
| 86 |
|
| 87 |
-
if
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
st.info("Please add your OpenAI API key to continue.")
|
| 89 |
elif submitted:
|
|
|
|
|
|
|
| 90 |
response = generate_panel_response(
|
| 91 |
text,
|
| 92 |
-
llm_panelists=
|
| 93 |
-
llm_panel_chair=
|
| 94 |
temperature=temperature,
|
| 95 |
)
|
| 96 |
|
|
|
|
| 82 |
|
| 83 |
temperature = st.text_input("Temperature", value=0.1)
|
| 84 |
|
| 85 |
+
###Start of Kaan Changes
|
| 86 |
+
#Selectbox to determine which LLM becomes panel lead
|
| 87 |
+
panel_lead = st.radio("Which LLM would you like to lead this panel?", PREF_ORDER_LLMS, horizontal=True)
|
| 88 |
+
|
| 89 |
+
#Create checkboxes to determine which LLMs are included in the panel
|
| 90 |
+
st.markdown("<div style='text-align: left; font-size: 14px;'>Which LLMs would you like to attend the panel?</div>", unsafe_allow_html=True)
|
| 91 |
+
options = PREF_ORDER_LLMS #[llm for llm in PREF_ORDER_LLMS if llm !=panel_lead] creates a list of options excluding the chosen panel lead
|
| 92 |
+
selected_options = []
|
| 93 |
+
#Put checkboxes into columns to be arranged horizontally
|
| 94 |
+
cols = st.columns(len(options))
|
| 95 |
+
for i, option in enumerate(options):
|
| 96 |
+
with cols[i]:
|
| 97 |
+
selected = st.checkbox(option, key=option)
|
| 98 |
+
if selected:
|
| 99 |
+
selected_options.append(option)
|
| 100 |
+
|
| 101 |
submitted = st.form_submit_button("Submit")
|
| 102 |
|
| 103 |
+
if len(selected_options) == 1 and panel_lead in selected_options:
|
| 104 |
+
st.markdown("Please choose a panelist that is not the panel lead.")
|
| 105 |
+
elif len(selected_options) == 0:
|
| 106 |
+
st.markdown("Please choose a panelist to join the panel lead.")
|
| 107 |
+
elif requires_openai_key(llm_ver) and not get_openai_api_key():
|
| 108 |
st.info("Please add your OpenAI API key to continue.")
|
| 109 |
elif submitted:
|
| 110 |
+
#Create new list of LLMs that does not include panel lead
|
| 111 |
+
llm_panelists = [llm for llm in selected_options if llm !=panel_lead]
|
| 112 |
response = generate_panel_response(
|
| 113 |
text,
|
| 114 |
+
llm_panelists=llm_panelists,
|
| 115 |
+
llm_panel_chair=panel_lead,
|
| 116 |
temperature=temperature,
|
| 117 |
)
|
| 118 |
|