Spaces:
Sleeping
Sleeping
Update server.py
Browse files
server.py
CHANGED
@@ -1,9 +1,11 @@
|
|
1 |
import os
|
2 |
from utilities.transcripts import VTTTranscriptLoader, DocumentEmbedder
|
|
|
|
|
3 |
|
4 |
class EmbeddingService:
|
5 |
def __init__(self, conf):
|
6 |
-
self.keys =
|
7 |
self.conf = conf
|
8 |
|
9 |
def __enter__(self):
|
@@ -12,14 +14,6 @@ class EmbeddingService:
|
|
12 |
|
13 |
def __exit__(self, exc_type, exc_val, exc_tb):
|
14 |
print("Exiting Embedding Service")
|
15 |
-
|
16 |
-
def get_keys(self):
|
17 |
-
"Get keys required to set up loading"
|
18 |
-
return {
|
19 |
-
"pinecone": os.environ["PINECONE_TOKEN"],
|
20 |
-
"huggingface": os.environ["HUGGINGFACE_TOKEN"],
|
21 |
-
"openai": "", # leaving this alone for future use.
|
22 |
-
}
|
23 |
|
24 |
def get_transcripts(self, files):
|
25 |
# Get filepaths and load them in document format
|
@@ -48,8 +42,25 @@ class EmbeddingService:
|
|
48 |
|
49 |
class QAService:
|
50 |
def __init__(self, conf):
|
51 |
-
self.keys = get_keys()
|
52 |
self.conf = conf
|
53 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
def run():
|
55 |
return 0
|
|
|
1 |
import os
|
2 |
from utilities.transcripts import VTTTranscriptLoader, DocumentEmbedder
|
3 |
+
from utilities.setup import get_files
|
4 |
+
|
5 |
|
6 |
class EmbeddingService:
|
7 |
def __init__(self, conf):
|
8 |
+
self.keys = get_files.get_keys()
|
9 |
self.conf = conf
|
10 |
|
11 |
def __enter__(self):
|
|
|
14 |
|
15 |
def __exit__(self, exc_type, exc_val, exc_tb):
|
16 |
print("Exiting Embedding Service")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
|
18 |
def get_transcripts(self, files):
|
19 |
# Get filepaths and load them in document format
|
|
|
42 |
|
43 |
class QAService:
|
44 |
def __init__(self, conf):
|
45 |
+
self.keys = get_files.get_keys()
|
46 |
self.conf = conf
|
47 |
|
48 |
+
def __enter__(self):
|
49 |
+
print("Start QA Service")
|
50 |
+
return self
|
51 |
+
|
52 |
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
53 |
+
print("Exiting QA Service")
|
54 |
+
|
55 |
+
# First embed question
|
56 |
+
|
57 |
+
# Next, pass it into pinecone
|
58 |
+
|
59 |
+
# Third, retrieve pinecone search
|
60 |
+
|
61 |
+
# Structure query
|
62 |
+
|
63 |
+
# inference QA model
|
64 |
+
|
65 |
def run():
|
66 |
return 0
|