Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -177,7 +177,16 @@ st.caption("Hybrid Rule-based + AI (OpenRouter) β’ KP Digital Roadmap 2030 β
|
|
| 177 |
|
| 178 |
with st.sidebar:
|
| 179 |
st.header("βοΈ Settings")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 180 |
cfg = {
|
|
|
|
| 181 |
"model": st.text_input("Model", value=DEFAULT_MODEL),
|
| 182 |
"use_ai": st.toggle("Use AI", value=True),
|
| 183 |
"always_ai": st.toggle("Always use AI (else only when rules unsure)", value=False),
|
|
@@ -187,7 +196,7 @@ with st.sidebar:
|
|
| 187 |
}
|
| 188 |
if cfg["use_ai"] and not cfg["api_key"]:
|
| 189 |
st.warning("No API key β running rule-based only.")
|
| 190 |
-
|
| 191 |
files = st.file_uploader("Upload documents", type=["txt", "pdf", "docx"], accept_multiple_files=True)
|
| 192 |
|
| 193 |
if files and st.button("π Classify", type="primary"):
|
|
|
|
| 177 |
|
| 178 |
with st.sidebar:
|
| 179 |
st.header("βοΈ Settings")
|
| 180 |
+
|
| 181 |
+
api_key = default_key() # loaded silently β never rendered
|
| 182 |
+
if api_key:
|
| 183 |
+
st.success("π API key loaded securely")
|
| 184 |
+
else:
|
| 185 |
+
api_key = st.text_input("OpenRouter API Key", type="password",
|
| 186 |
+
placeholder="Paste key (not saved)")
|
| 187 |
+
|
| 188 |
cfg = {
|
| 189 |
+
"api_key": api_key,
|
| 190 |
"model": st.text_input("Model", value=DEFAULT_MODEL),
|
| 191 |
"use_ai": st.toggle("Use AI", value=True),
|
| 192 |
"always_ai": st.toggle("Always use AI (else only when rules unsure)", value=False),
|
|
|
|
| 196 |
}
|
| 197 |
if cfg["use_ai"] and not cfg["api_key"]:
|
| 198 |
st.warning("No API key β running rule-based only.")
|
| 199 |
+
|
| 200 |
files = st.file_uploader("Upload documents", type=["txt", "pdf", "docx"], accept_multiple_files=True)
|
| 201 |
|
| 202 |
if files and st.button("π Classify", type="primary"):
|