Guiyom commited on
Commit
a1269f9
·
1 Parent(s): 3c6a95b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -110,14 +110,16 @@ with gr.Blocks(theme=gr.themes.Glass()) as demo:
110
  #Append instructions to msg
111
  listvalues = getlist(df)
112
  print(f'listvalues: {listvalues}')
113
- queryforcategory = [{'role':'user','content':f"Out of this list of words/expressions separated by a comma:\n{listvalues}\n, which one corresponds the best to the theme in this message:\n{msg}\n\nThe result should be one of the elements from the list only."}]
114
  matchcat = answer(queryforcategory)
 
115
  print(f'matchcat: {matchcat}')
116
  instructions = filter_and_concatenate(df, matchcat)
117
  print(f'instructions: {instructions}')
118
- msg = msg +f"\n\nUse the following elements to document your answer:\n{instructions}"
119
  msg = msg + f"\n\nAnswer in {language}, keep it casual but respectful"
120
  state.append({'role':'user','content':msg})
 
 
121
  print(f'state is\n{state}')
122
  print(f'chatbot is\n{chatbot}')
123
  return "", chatbot, state
 
110
  #Append instructions to msg
111
  listvalues = getlist(df)
112
  print(f'listvalues: {listvalues}')
113
+ queryforcategory = [{'role':'user','content':f"Out of this list of words/expressions separated by a comma:\n{listvalues}\n, which one corresponds the best to the theme in this message:\n{msg}\n\nThe result should be one of the elements from the list only. If there's absolutly no match, return an empty string '' "}]
114
  matchcat = answer(queryforcategory)
115
+ matchcat = matchcat.replace('.','')
116
  print(f'matchcat: {matchcat}')
117
  instructions = filter_and_concatenate(df, matchcat)
118
  print(f'instructions: {instructions}')
 
119
  msg = msg + f"\n\nAnswer in {language}, keep it casual but respectful"
120
  state.append({'role':'user','content':msg})
121
+ if mode == 'mode3':
122
+ state.append({'role':'system','content':f"\n\nUse the following elements to document your answer:\n{instructions}"})
123
  print(f'state is\n{state}')
124
  print(f'chatbot is\n{chatbot}')
125
  return "", chatbot, state