Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +12 -13
src/streamlit_app.py
CHANGED
|
@@ -97,7 +97,6 @@ DEFAULT_CORPUS = [
|
|
| 97 |
#Select from 4 different models
|
| 98 |
MODELS = ["Qwen/Qwen1.5-0.5B", "deepseek-ai/deepseek-coder-1.3b-instruct", "openai-community/gpt2", "prem-research/MiniGuard-v0.1"]
|
| 99 |
|
| 100 |
-
"""## Defining Utility Functions"""
|
| 101 |
|
| 102 |
# ====== Utilities =========================================================================
|
| 103 |
def seed_everything(seed: int = 42):
|
|
@@ -628,7 +627,7 @@ def main():
|
|
| 628 |
st.header("Graph")
|
| 629 |
graph_mode = st.selectbox("Graph mode", ["knn", "threshold"], index=0)
|
| 630 |
knn_k = st.slider("k (kNN)", 2, 50, 8) if graph_mode == "knn" else 8
|
| 631 |
-
sim_threshold = st.slider("Similarity threshold", 0.0, 0.99, 0.
|
| 632 |
use_cosine = st.checkbox("Use cosine similarity", value=True)
|
| 633 |
|
| 634 |
st.header("Anchors / LoT")
|
|
@@ -648,18 +647,18 @@ def main():
|
|
| 648 |
|
| 649 |
prompt_col, run_col = st.columns([4, 1])
|
| 650 |
|
| 651 |
-
|
| 652 |
-
|
| 653 |
-
|
| 654 |
-
|
| 655 |
-
|
| 656 |
-
|
| 657 |
-
|
| 658 |
|
| 659 |
-
|
| 660 |
-
|
| 661 |
-
|
| 662 |
-
|
| 663 |
|
| 664 |
cfg = Config(
|
| 665 |
model_name=model_name,
|
|
|
|
| 97 |
#Select from 4 different models
|
| 98 |
MODELS = ["Qwen/Qwen1.5-0.5B", "deepseek-ai/deepseek-coder-1.3b-instruct", "openai-community/gpt2", "prem-research/MiniGuard-v0.1"]
|
| 99 |
|
|
|
|
| 100 |
|
| 101 |
# ====== Utilities =========================================================================
|
| 102 |
def seed_everything(seed: int = 42):
|
|
|
|
| 627 |
st.header("Graph")
|
| 628 |
graph_mode = st.selectbox("Graph mode", ["knn", "threshold"], index=0)
|
| 629 |
knn_k = st.slider("k (kNN)", 2, 50, 8) if graph_mode == "knn" else 8
|
| 630 |
+
sim_threshold = st.slider("Similarity threshold", 0.0, 0.99, 0.05, step=0.01) if graph_mode == "threshold" else 0.70
|
| 631 |
use_cosine = st.checkbox("Use cosine similarity", value=True)
|
| 632 |
|
| 633 |
st.header("Anchors / LoT")
|
|
|
|
| 647 |
|
| 648 |
prompt_col, run_col = st.columns([4, 1])
|
| 649 |
|
| 650 |
+
with prompt_col:
|
| 651 |
+
main_text = st.selectbox(
|
| 652 |
+
"Prompt to visualize (hidden states computed on this text)",
|
| 653 |
+
options=DEFAULT_CORPUS,
|
| 654 |
+
index=0,
|
| 655 |
+
help="Select a predefined prompt for analysis"
|
| 656 |
+
)
|
| 657 |
|
| 658 |
+
with run_col:
|
| 659 |
+
st.write("")
|
| 660 |
+
st.write("")
|
| 661 |
+
run_btn = st.button("Run", type="primary")
|
| 662 |
|
| 663 |
cfg = Config(
|
| 664 |
model_name=model_name,
|