Spaces:
Running
Running
arslan-ahmed
commited on
Commit
•
0994464
1
Parent(s):
cec2c05
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import datetime
|
2 |
import openai
|
3 |
import uuid
|
@@ -29,8 +30,16 @@ from ttyd_consts import *
|
|
29 |
|
30 |
|
31 |
# select the mode at runtime when starting container - modes options are in ttyd_consts.py
|
32 |
-
|
|
|
33 |
mode = mode_arslan
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
elif os.getenv("TTYD_MODE")=='nustian':
|
35 |
mode = mode_nustian
|
36 |
else:
|
@@ -71,7 +80,7 @@ def initializeChatbot(temp, k, modelName, stdlQs, api_key_st, vsDict_st, progres
|
|
71 |
welMsg = mode.welcomeMsg
|
72 |
else:
|
73 |
welMsg = qa_chain_st({'question': initialize_prompt, 'chat_history':[]})['answer']
|
74 |
-
|
75 |
# exSamples = generateExamples(api_key_st, vsDict_st)
|
76 |
# exSamples_vis = True if exSamples[0] else False
|
77 |
|
|
|
1 |
+
import gdown
|
2 |
import datetime
|
3 |
import openai
|
4 |
import uuid
|
|
|
30 |
|
31 |
|
32 |
# select the mode at runtime when starting container - modes options are in ttyd_consts.py
|
33 |
+
|
34 |
+
if (os.getenv("TTYD_MODE")).split('_')[0]=='personalBot':
|
35 |
mode = mode_arslan
|
36 |
+
gDriveUrl = os.getenv("GDRIVE_FOLDER_URL")
|
37 |
+
# output folder of googe drive folder will be taken as input dir of personalBot
|
38 |
+
gdown.download_folder(url=gDriveUrl, output=mode.inputDir, quiet=True)
|
39 |
+
if os.getenv("TTYD_MODE")!='personalBot_arslan':
|
40 |
+
mode.title=''
|
41 |
+
mode.welcomeMsg=''
|
42 |
+
|
43 |
elif os.getenv("TTYD_MODE")=='nustian':
|
44 |
mode = mode_nustian
|
45 |
else:
|
|
|
80 |
welMsg = mode.welcomeMsg
|
81 |
else:
|
82 |
welMsg = qa_chain_st({'question': initialize_prompt, 'chat_history':[]})['answer']
|
83 |
+
print('Chatbot initialized at ', datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S'))
|
84 |
# exSamples = generateExamples(api_key_st, vsDict_st)
|
85 |
# exSamples_vis = True if exSamples[0] else False
|
86 |
|