Walelign commited on
Commit
9fcadef
·
verified ·
1 Parent(s): 6128e3b

Upload 5 files

Browse files
amharic_srh_chatbot_updated.zip ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9f68b50e7bd170ce14321b3fe78d7a6e52801cd05158eb9b9dfebf204e655cc9
3
+ size 1979
amharic_srh_qa.csv ADDED
The diff for this file is too large to render. See raw diff
 
chatbot_utils.py ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ import pandas as pd
3
+ import faiss
4
+ from sentence_transformers import SentenceTransformer
5
+ import numpy as np
6
+
7
+ class AmharicChatbot:
8
+ def __init__(self, csv_path):
9
+ self.df = pd.read_csv(csv_path)
10
+ self.model = SentenceTransformer("intfloat/multilingual-e5-small")
11
+ self.build_index()
12
+
13
+ def build_index(self):
14
+ self.embeddings = self.model.encode(
15
+ ["passage: " + q for q in self.df["question"].tolist()],
16
+ show_progress_bar=True
17
+ )
18
+ self.index = faiss.IndexFlatL2(self.embeddings.shape[1])
19
+ self.index.add(np.array(self.embeddings))
20
+
21
+ def get_answer(self, query, top_k=3):
22
+ query_embedding = self.model.encode([f"query: {query}"])
23
+ D, I = self.index.search(np.array(query_embedding), top_k)
24
+ results = []
25
+ for idx in I[0]:
26
+ question = self.df.iloc[idx]["question"]
27
+ answer = self.df.iloc[idx]["answer"]
28
+ results.append((question, answer))
29
+ return results
log.txt ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Collecting usage statistics. To deactivate, set browser.gatherUsageStats to false.
3
+
4
+
5
+ You can now view your Streamlit app in your browser.
6
+
7
+ Local URL: http://localhost:8501
8
+ Network URL: http://172.28.0.12:8501
9
+ External URL: http://34.82.23.33:8501
10
+
11
+ 2025-04-09 16:05:13.000077: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:477] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
12
+ WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
13
+ E0000 00:00:1744214713.355497 1784 cuda_dnn.cc:8310] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
14
+ E0000 00:00:1744214713.443025 1784 cuda_blas.cc:1418] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
15
+ 2025-04-09 16:05:14.130627: I tensorflow/core/platform/cpu_feature_guard.cc:210] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
16
+ To enable the following instructions: AVX2 FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
17
+
18
+ 2025-04-09 16:07:07.123 Examining the path of torch.classes raised:
19
+ Traceback (most recent call last):
20
+ File "/usr/local/lib/python3.11/dist-packages/streamlit/web/bootstrap.py", line 347, in run
21
+ if asyncio.get_running_loop().is_running():
22
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
23
+ RuntimeError: no running event loop
24
+
25
+ During handling of the above exception, another exception occurred:
26
+
27
+ Traceback (most recent call last):
28
+ File "/usr/local/lib/python3.11/dist-packages/streamlit/watcher/local_sources_watcher.py", line 217, in get_module_paths
29
+ potential_paths = extract_paths(module)
30
+ ^^^^^^^^^^^^^^^^^^^^^
31
+ File "/usr/local/lib/python3.11/dist-packages/streamlit/watcher/local_sources_watcher.py", line 210, in <lambda>
32
+ lambda m: list(m.__path__._path),
33
+ ^^^^^^^^^^^^^^^^
34
+ File "/usr/local/lib/python3.11/dist-packages/torch/_classes.py", line 13, in __getattr__
35
+ proxy = torch._C._get_custom_class_python_wrapper(self.name, attr)
36
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
37
+ RuntimeError: Tried to instantiate class '__path__._path', but it does not exist! Ensure that it is registered via torch::class_
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ streamlit
2
+ sentence-transformers
3
+ faiss-cpu
4
+ pandas