BaRiDo commited on
Commit
5e67151
·
verified ·
1 Parent(s): a406615

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -24
app.py CHANGED
@@ -67,42 +67,20 @@ def IBM_chat (messages):
67
  response = response.json()
68
  return response["choices"][0]["message"]["content"]
69
 
70
- ## get token
71
- IBM_token()
72
-
73
  def get_credentials():
74
  return {
75
  "url" : "https://us-south.ml.cloud.ibm.com",
76
  "apikey" : os.getenv("IBM_API_KEY")
77
  }
78
 
79
- model_id = "ibm/granite-3-8b-instruct"
80
-
81
- parameters = {
82
- "decoding_method": "greedy",
83
- "max_new_tokens": 900,
84
- "min_new_tokens": 0,
85
- "repetition_penalty": 1
86
- }
87
-
88
- project_id = os.getenv("IBM_PROJECT_ID")
89
- #space_id = os.getenv("IBM_SPACE_ID")
90
-
91
  from ibm_watsonx_ai.foundation_models import ModelInference
92
-
93
- #model = ModelInference(
94
- # model_id = model_id,
95
- # params = parameters,
96
- # credentials = get_credentials(),
97
- # project_id = project_id,
98
- # space_id = space_id
99
- # )
100
-
101
  from ibm_watsonx_ai.client import APIClient
102
 
103
  if "client" not in st.session_state:
104
  with st.spinner("⏳ Waking the wizard ..."):
 
105
  wml_credentials = get_credentials()
 
106
  st.session_state.client = APIClient(credentials=wml_credentials, project_id=project_id)
107
 
108
  vector_index_id = VECTOR_DB
 
67
  response = response.json()
68
  return response["choices"][0]["message"]["content"]
69
 
 
 
 
70
  def get_credentials():
71
  return {
72
  "url" : "https://us-south.ml.cloud.ibm.com",
73
  "apikey" : os.getenv("IBM_API_KEY")
74
  }
75
 
 
 
 
 
 
 
 
 
 
 
 
 
76
  from ibm_watsonx_ai.foundation_models import ModelInference
 
 
 
 
 
 
 
 
 
77
  from ibm_watsonx_ai.client import APIClient
78
 
79
  if "client" not in st.session_state:
80
  with st.spinner("⏳ Waking the wizard ..."):
81
+ IBM_token()
82
  wml_credentials = get_credentials()
83
+ project_id = os.getenv("IBM_PROJECT_ID")
84
  st.session_state.client = APIClient(credentials=wml_credentials, project_id=project_id)
85
 
86
  vector_index_id = VECTOR_DB