arslan-ahmed commited on
Commit
8324708
1 Parent(s): fa0ffc9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -43,7 +43,7 @@ TTYD_MODE = os.getenv("TTYD_MODE",'')
43
  # select the mode when starting container - modes options are in ttyd_consts.py
44
  if TTYD_MODE.split('_')[0]=='personalBot':
45
  mode = mode_arslan
46
- if TTYD_MODE!='personalBot_arslan':
47
  user = TTYD_MODE.split('_')[1]
48
  mode.title='## Talk to '+user
49
  mode.welcomeMsg= welcomeMsgUser(user)
@@ -69,7 +69,7 @@ def setOaiApiKey(creds):
69
  try:
70
  openai.Model.list(api_key=creds.get('oai_key','Null')) # test the API key
71
  api_key_st = creds
72
- return 'OpenAI credentials accepted', *[x.update(interactive=False) for x in credComps_btn_tb], api_key_st
73
  except Exception as e:
74
  gr.Warning(str(e))
75
  return [x.update() for x in credComps_op]
@@ -79,7 +79,7 @@ def setBamApiKey(creds):
79
  try:
80
  genai.Model.models(credentials=creds['bam_creds'])
81
  api_key_st = creds
82
- return 'BAM credentials accepted', *[x.update(interactive=False) for x in credComps_btn_tb], api_key_st
83
  except Exception as e:
84
  gr.Warning(str(e))
85
  return [x.update() for x in credComps_op]
@@ -89,7 +89,7 @@ def setWxApiKey(key, p_id):
89
  try:
90
  Model(model_id='google/flan-ul2', credentials=creds['credentials'], project_id=creds['project_id']) # test the API key
91
  api_key_st = creds
92
- return 'Watsonx credentials accepted', *[x.update(interactive=False) for x in credComps_btn_tb], api_key_st
93
  except Exception as e:
94
  gr.Warning(str(e))
95
  return [x.update() for x in credComps_op]
 
43
  # select the mode when starting container - modes options are in ttyd_consts.py
44
  if TTYD_MODE.split('_')[0]=='personalBot':
45
  mode = mode_arslan
46
+ if TTYD_MODE!='personalBot_Arslan':
47
  user = TTYD_MODE.split('_')[1]
48
  mode.title='## Talk to '+user
49
  mode.welcomeMsg= welcomeMsgUser(user)
 
69
  try:
70
  openai.Model.list(api_key=creds.get('oai_key','Null')) # test the API key
71
  api_key_st = creds
72
+ return 'OpenAI credentials accepted.', *[x.update(interactive=False) for x in credComps_btn_tb], api_key_st
73
  except Exception as e:
74
  gr.Warning(str(e))
75
  return [x.update() for x in credComps_op]
 
79
  try:
80
  genai.Model.models(credentials=creds['bam_creds'])
81
  api_key_st = creds
82
+ return 'BAM credentials accepted.', *[x.update(interactive=False) for x in credComps_btn_tb], api_key_st
83
  except Exception as e:
84
  gr.Warning(str(e))
85
  return [x.update() for x in credComps_op]
 
89
  try:
90
  Model(model_id='google/flan-ul2', credentials=creds['credentials'], project_id=creds['project_id']) # test the API key
91
  api_key_st = creds
92
+ return 'Watsonx credentials accepted.', *[x.update(interactive=False) for x in credComps_btn_tb], api_key_st
93
  except Exception as e:
94
  gr.Warning(str(e))
95
  return [x.update() for x in credComps_op]