Spaces:
Sleeping
Sleeping
Commit
·
e106cc0
1
Parent(s):
bde636a
Refactor app.py and requirements.txt; remove SemanticSearcher and update numpy version
Browse files- app.py +2 -3
- requirements.txt +1 -1
- src/__init__.py +0 -0
- src/bert_model +0 -3
- src/semantic_searcher.py +1 -2
- src/upvote_predictor.py +1 -3
app.py
CHANGED
@@ -5,7 +5,6 @@ import pandas as pd
|
|
5 |
from datasets import load_dataset
|
6 |
|
7 |
from src.genai import GenAI
|
8 |
-
from src.semantic_searcher import SemanticSearcher
|
9 |
from src.upvote_predictor import UpvotePredictor
|
10 |
|
11 |
# Load the dataset
|
@@ -52,8 +51,8 @@ examples = "\n".join(
|
|
52 |
|
53 |
# Initialize the SemanticSearcher
|
54 |
genai = GenAI()
|
55 |
-
upvote_predictor = UpvotePredictor("
|
56 |
-
_ = SemanticSearcher(df_counsel_chat_topic)
|
57 |
|
58 |
|
59 |
def get_output(question: str, question_context: str = None) -> str:
|
|
|
5 |
from datasets import load_dataset
|
6 |
|
7 |
from src.genai import GenAI
|
|
|
8 |
from src.upvote_predictor import UpvotePredictor
|
9 |
|
10 |
# Load the dataset
|
|
|
51 |
|
52 |
# Initialize the SemanticSearcher
|
53 |
genai = GenAI()
|
54 |
+
upvote_predictor = UpvotePredictor("src/bert_model")
|
55 |
+
# _ = SemanticSearcher(df_counsel_chat_topic)
|
56 |
|
57 |
|
58 |
def get_output(question: str, question_context: str = None) -> str:
|
requirements.txt
CHANGED
@@ -46,7 +46,7 @@ mpmath==1.3.0
|
|
46 |
multidict==6.1.0; python_version >= '3.8'
|
47 |
multiprocess==0.70.16; python_version >= '3.8'
|
48 |
networkx==3.4.2; python_version >= '3.10'
|
49 |
-
numpy==
|
50 |
openai==1.66.3; python_version >= '3.8'
|
51 |
orjson==3.10.15; python_version >= '3.8'
|
52 |
packaging==24.2; python_version >= '3.8'
|
|
|
46 |
multidict==6.1.0; python_version >= '3.8'
|
47 |
multiprocess==0.70.16; python_version >= '3.8'
|
48 |
networkx==3.4.2; python_version >= '3.10'
|
49 |
+
numpy==1.26.4; python_version >= '3.9'
|
50 |
openai==1.66.3; python_version >= '3.8'
|
51 |
orjson==3.10.15; python_version >= '3.8'
|
52 |
packaging==24.2; python_version >= '3.8'
|
src/__init__.py
ADDED
File without changes
|
src/bert_model
DELETED
@@ -1,3 +0,0 @@
|
|
1 |
-
version https://git-lfs.github.com/spec/v1
|
2 |
-
oid sha256:cc67a668274575af4cda22c97d41acbb6fb11a23a8871a8f7bce9a579ba6ea51
|
3 |
-
size 438062089
|
|
|
|
|
|
|
|
src/semantic_searcher.py
CHANGED
@@ -11,8 +11,7 @@ class SemanticSearcher:
|
|
11 |
show_progress_bar=True,
|
12 |
convert_to_tensor=True,
|
13 |
)
|
14 |
-
|
15 |
-
def retrieve_relevant_qna(self, question: str, question_context: str = None) -> str:
|
16 |
if question_context is None:
|
17 |
question_context = ""
|
18 |
query = question + "\n" + question_context
|
|
|
11 |
show_progress_bar=True,
|
12 |
convert_to_tensor=True,
|
13 |
)
|
14 |
+
def retrieve_relevant_qna(self, question: str, question_context: str = None):
|
|
|
15 |
if question_context is None:
|
16 |
question_context = ""
|
17 |
query = question + "\n" + question_context
|
src/upvote_predictor.py
CHANGED
@@ -4,8 +4,6 @@ import torch
|
|
4 |
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
|
5 |
from transformers import BertTokenizer
|
6 |
|
7 |
-
from src.semantic_searcher import retrieve_relevant_qna
|
8 |
-
|
9 |
|
10 |
class UpvotePredictor:
|
11 |
def __init__(self, model_path: str):
|
@@ -65,7 +63,7 @@ class UpvotePredictor:
|
|
65 |
if predictions[0] == 0:
|
66 |
return (
|
67 |
"Not credible suggestion",
|
68 |
-
|
69 |
)
|
70 |
else:
|
71 |
return ("Credible suggestion", pd.DataFrame())
|
|
|
4 |
from torch.utils.data import DataLoader, SequentialSampler, TensorDataset
|
5 |
from transformers import BertTokenizer
|
6 |
|
|
|
|
|
7 |
|
8 |
class UpvotePredictor:
|
9 |
def __init__(self, model_path: str):
|
|
|
63 |
if predictions[0] == 0:
|
64 |
return (
|
65 |
"Not credible suggestion",
|
66 |
+
pd.DataFrame(),
|
67 |
)
|
68 |
else:
|
69 |
return ("Credible suggestion", pd.DataFrame())
|