Upload fun_advaitbert.py
Browse files- fun_advaitbert.py +9 -3
fun_advaitbert.py
CHANGED
|
@@ -225,6 +225,7 @@ def predict_CTH(txt):
|
|
| 225 |
|
| 226 |
def llm_model_function(txt,history,chatbot=[], temperature=0.9, max_new_tokens=1024, top_p=0.95, repetition_penalty=1.0,):
|
| 227 |
system_prompt=[]
|
|
|
|
| 228 |
if (txt!='') and len(txt)>=3 and (count_special_character(txt)):
|
| 229 |
valid_data = tf.data.Dataset.from_tensor_slices(([txt] , [1])) # 1 refers to 'entertainment' and 2 refers to 'sport'
|
| 230 |
valid_data = (valid_data.map(to_feature_map).batch(1))
|
|
@@ -248,7 +249,9 @@ def llm_model_function(txt,history,chatbot=[], temperature=0.9, max_new_tokens=1
|
|
| 248 |
pred_desc=''
|
| 249 |
pred_CTH=''
|
| 250 |
|
| 251 |
-
return{'Not a adequate description':float(1.0)}
|
|
|
|
|
|
|
| 252 |
else:
|
| 253 |
Var_CTH=[]
|
| 254 |
Var_desc=[]
|
|
@@ -306,11 +309,14 @@ def llm_model_function(txt,history,chatbot=[], temperature=0.9, max_new_tokens=1
|
|
| 306 |
chatbot.append((txt, output))
|
| 307 |
return "", chatbot
|
| 308 |
else:
|
| 309 |
-
warning_msg = f"Unexpected response"
|
| 310 |
-
raise gr.Error(warning_msg)
|
|
|
|
|
|
|
| 311 |
|
| 312 |
def product_explaination(txt,history,chatbot=[], temperature=0.9, max_new_tokens=1024, top_p=0.95, repetition_penalty=1.0,):
|
| 313 |
print('Input Descrption is:',txt)
|
|
|
|
| 314 |
prompt=f'What is the product- {txt}?'
|
| 315 |
print('prompt',prompt)
|
| 316 |
temperature = float(temperature)
|
|
|
|
| 225 |
|
| 226 |
def llm_model_function(txt,history,chatbot=[], temperature=0.9, max_new_tokens=1024, top_p=0.95, repetition_penalty=1.0,):
|
| 227 |
system_prompt=[]
|
| 228 |
+
chatbot=[]
|
| 229 |
if (txt!='') and len(txt)>=3 and (count_special_character(txt)):
|
| 230 |
valid_data = tf.data.Dataset.from_tensor_slices(([txt] , [1])) # 1 refers to 'entertainment' and 2 refers to 'sport'
|
| 231 |
valid_data = (valid_data.map(to_feature_map).batch(1))
|
|
|
|
| 249 |
pred_desc=''
|
| 250 |
pred_CTH=''
|
| 251 |
|
| 252 |
+
#return{'Not a adequate description':float(1.0)}
|
| 253 |
+
chatbot.append(('Not a adequate description', 'Not a adequate description'))
|
| 254 |
+
return "", chatbot
|
| 255 |
else:
|
| 256 |
Var_CTH=[]
|
| 257 |
Var_desc=[]
|
|
|
|
| 309 |
chatbot.append((txt, output))
|
| 310 |
return "", chatbot
|
| 311 |
else:
|
| 312 |
+
# warning_msg = f"Unexpected response"
|
| 313 |
+
# raise gr.Error(warning_msg)
|
| 314 |
+
chatbot.append(('Not a adequate description', 'Not a adequate description'))
|
| 315 |
+
return "", chatbot
|
| 316 |
|
| 317 |
def product_explaination(txt,history,chatbot=[], temperature=0.9, max_new_tokens=1024, top_p=0.95, repetition_penalty=1.0,):
|
| 318 |
print('Input Descrption is:',txt)
|
| 319 |
+
chatbot=[]
|
| 320 |
prompt=f'What is the product- {txt}?'
|
| 321 |
print('prompt',prompt)
|
| 322 |
temperature = float(temperature)
|