Spaces:
Running
Running
Added custom suggestions.
Browse files
app/streamlit_sample_generator.py
CHANGED
@@ -274,6 +274,12 @@ def generate_suggestions():
|
|
274 |
except Exception as e:
|
275 |
st.warning(f"Failed to generate suggestions: {str(e)}")
|
276 |
|
|
|
|
|
|
|
|
|
|
|
|
|
277 |
# Streamlit UI
|
278 |
st.title("LLM Task Example Generator")
|
279 |
st.markdown("Enter input-output pairs in the table below to generate a task description, analysis, and additional examples.")
|
@@ -335,7 +341,10 @@ with st.expander("Description and Analysis"):
|
|
335 |
# Add multiselect for suggestions
|
336 |
selected_suggestions = st.multiselect(
|
337 |
"Suggestions", options=st.session_state.suggestions, key="selected_suggestions")
|
338 |
-
|
|
|
|
|
|
|
339 |
# Add button to apply suggestions
|
340 |
apply_suggestions_button = st.button("Apply Suggestions", on_click=apply_suggestions)
|
341 |
|
|
|
274 |
except Exception as e:
|
275 |
st.warning(f"Failed to generate suggestions: {str(e)}")
|
276 |
|
277 |
+
# Function to add new suggestion to the list and select it
|
278 |
+
def add_new_suggestion():
|
279 |
+
if st.session_state.new_suggestion:
|
280 |
+
st.session_state.suggestions.append(st.session_state.new_suggestion)
|
281 |
+
st.session_state.new_suggestion = "" # Clear the input field
|
282 |
+
|
283 |
# Streamlit UI
|
284 |
st.title("LLM Task Example Generator")
|
285 |
st.markdown("Enter input-output pairs in the table below to generate a task description, analysis, and additional examples.")
|
|
|
341 |
# Add multiselect for suggestions
|
342 |
selected_suggestions = st.multiselect(
|
343 |
"Suggestions", options=st.session_state.suggestions, key="selected_suggestions")
|
344 |
+
|
345 |
+
# Add text input for adding new suggestions
|
346 |
+
new_suggestion = st.text_input("Add New Suggestion", key="new_suggestion", on_change=add_new_suggestion)
|
347 |
+
|
348 |
# Add button to apply suggestions
|
349 |
apply_suggestions_button = st.button("Apply Suggestions", on_click=apply_suggestions)
|
350 |
|