Commit
·
ebb7fd5
1
Parent(s):
1004d14
Update
Browse files- app-ngrok.py +12 -12
app-ngrok.py
CHANGED
@@ -23,20 +23,20 @@ initial_model = "WizardLM/WizardCoder-15B-V1.0"
|
|
23 |
lora_model = "richardr1126/spider-skeleton-wizard-coder-qlora"
|
24 |
dataset = "richardr1126/spider-skeleton-context-instruct"
|
25 |
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
json_data = json_bytes.decode('utf-8')
|
32 |
|
33 |
-
|
34 |
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
|
|
|
40 |
doc_ref = db.collection('logs').document()
|
41 |
log_data = {
|
42 |
'timestamp': firestore.SERVER_TIMESTAMP,
|
@@ -46,7 +46,7 @@ def log_to_firestore(input_message, db_info, temperature, response_text):
|
|
46 |
'output': response_text
|
47 |
}
|
48 |
doc_ref.set(log_data)
|
49 |
-
|
50 |
|
51 |
def format(text):
|
52 |
# Split the text by "|", and get the last element in the list which should be the final query
|
|
|
23 |
lora_model = "richardr1126/spider-skeleton-wizard-coder-qlora"
|
24 |
dataset = "richardr1126/spider-skeleton-context-instruct"
|
25 |
|
26 |
+
# Initialize Firebase
|
27 |
+
base64_string = os.getenv('FIREBASE')
|
28 |
+
base64_bytes = base64_string.encode('utf-8')
|
29 |
+
json_bytes = base64.b64decode(base64_bytes)
|
30 |
+
json_data = json_bytes.decode('utf-8')
|
|
|
31 |
|
32 |
+
firebase_auth = json.loads(json_data)
|
33 |
|
34 |
+
# Load credentials and initialize Firestore
|
35 |
+
cred = credentials.Certificate(firebase_auth)
|
36 |
+
firebase_admin.initialize_app(cred)
|
37 |
+
db = firestore.client()
|
38 |
|
39 |
+
def log_to_firestore(input_message, db_info, temperature, response_text):
|
40 |
doc_ref = db.collection('logs').document()
|
41 |
log_data = {
|
42 |
'timestamp': firestore.SERVER_TIMESTAMP,
|
|
|
46 |
'output': response_text
|
47 |
}
|
48 |
doc_ref.set(log_data)
|
49 |
+
# End Firebase code
|
50 |
|
51 |
def format(text):
|
52 |
# Split the text by "|", and get the last element in the list which should be the final query
|