Spaces:
Running
Running
Upload folder using huggingface_hub
Browse files- src/explain_service/explainer.py +13 -2
- src/ui/streamlit_app.py +1 -2
src/explain_service/explainer.py
CHANGED
|
@@ -12,9 +12,20 @@ a an the and or but if while with without for on in into by to from of is are wa
|
|
| 12 |
|
| 13 |
class Explainer:
|
| 14 |
def __init__(self):
|
|
|
|
| 15 |
self.model = SentenceTransformer("all-MiniLM-L6-v2")
|
| 16 |
-
|
| 17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 18 |
|
| 19 |
# ---------------------------
|
| 20 |
# TOKENIZER
|
|
|
|
| 12 |
|
| 13 |
class Explainer:
|
| 14 |
def __init__(self):
|
| 15 |
+
# Sentence transformer for similarity scoring
|
| 16 |
self.model = SentenceTransformer("all-MiniLM-L6-v2")
|
| 17 |
+
|
| 18 |
+
# Load Gemini API key from environment
|
| 19 |
+
api_key = os.environ.get("GENAI_API_KEY")
|
| 20 |
+
|
| 21 |
+
# If key missing → disable LLM
|
| 22 |
+
if not api_key:
|
| 23 |
+
self.client = None
|
| 24 |
+
else:
|
| 25 |
+
try:
|
| 26 |
+
self.client = genai.Client(api_key=api_key)
|
| 27 |
+
except:
|
| 28 |
+
self.client = None
|
| 29 |
|
| 30 |
# ---------------------------
|
| 31 |
# TOKENIZER
|
src/ui/streamlit_app.py
CHANGED
|
@@ -27,8 +27,7 @@ from eval.evaluate import run_evaluation
|
|
| 27 |
API_GATEWAY_URL = "http://localhost:8000"
|
| 28 |
|
| 29 |
st.set_page_config(
|
| 30 |
-
page_title="
|
| 31 |
-
page_icon="✨",
|
| 32 |
layout="wide",
|
| 33 |
initial_sidebar_state="expanded", # Changed from "collapsed" to "expanded"
|
| 34 |
)
|
|
|
|
| 27 |
API_GATEWAY_URL = "http://localhost:8000"
|
| 28 |
|
| 29 |
st.set_page_config(
|
| 30 |
+
page_title="Doc-Fetch",
|
|
|
|
| 31 |
layout="wide",
|
| 32 |
initial_sidebar_state="expanded", # Changed from "collapsed" to "expanded"
|
| 33 |
)
|