Pclanglais commited on
Commit
8e70d50
1 Parent(s): 21e86e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -133,8 +133,7 @@ class MistralChatBot:
133
  def __init__(self, system_prompt="Le dialogue suivant est une conversation"):
134
  self.system_prompt = system_prompt
135
 
136
- def predict(self, user_message, context):
137
- #detailed_prompt = """### Question ###\n""" + user_message + "\n\n### Contexte ###\n" + context + "\n\n### Formule ###\n"
138
  detailed_prompt = """### Question ###\n""" + user_message + "\n\n### Field ###\n"
139
  prompts = [detailed_prompt]
140
  outputs = llm.generate(prompts, sampling_params, use_tqdm = False)
@@ -143,6 +142,15 @@ class MistralChatBot:
143
  fiches_html = ""
144
  return generated_text, fiches_html
145
 
 
 
 
 
 
 
 
 
 
146
  # Create the Falcon chatbot instance
147
  mistral_bot = MistralChatBot()
148
 
 
133
  def __init__(self, system_prompt="Le dialogue suivant est une conversation"):
134
  self.system_prompt = system_prompt
135
 
136
+ def predict_field(self, user_message, context):
 
137
  detailed_prompt = """### Question ###\n""" + user_message + "\n\n### Field ###\n"
138
  prompts = [detailed_prompt]
139
  outputs = llm.generate(prompts, sampling_params, use_tqdm = False)
 
142
  fiches_html = ""
143
  return generated_text, fiches_html
144
 
145
+ def predict_answer(self, user_message, context):
146
+ detailed_prompt = """### Question ###\n""" + user_message + "\n\n### Contexte ###\n" + context + "\n\n### Formule ###\n"
147
+ prompts = [detailed_prompt]
148
+ outputs = llm.generate(prompts, sampling_params, use_tqdm = False)
149
+ generated_text = outputs[0].outputs[0].text
150
+ print(generated_text)
151
+ fiches_html = ""
152
+ return generated_text, fiches_html
153
+
154
  # Create the Falcon chatbot instance
155
  mistral_bot = MistralChatBot()
156