Pclanglais commited on
Commit
38808db
1 Parent(s): 8e70d50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -133,7 +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_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)
@@ -184,8 +184,10 @@ with gr.Blocks(theme='gradio/monochrome') as demo:
184
  text_input = gr.Textbox(label="Your question", type="text", lines=1)
185
  context_input = gr.Textbox(label="Your context", type="text", lines=1)
186
  text_button = gr.Button("Query InaguaLLM")
 
187
  text_output = gr.HTML(label="Answer")
188
- text_button.click(mistral_bot.predict, inputs=[text_input, context_input], outputs=[text_output], api_name="convert-code")
 
189
 
190
  if __name__ == "__main__":
191
  demo.queue().launch()
 
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):
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)
 
184
  text_input = gr.Textbox(label="Your question", type="text", lines=1)
185
  context_input = gr.Textbox(label="Your context", type="text", lines=1)
186
  text_button = gr.Button("Query InaguaLLM")
187
+ field_output = gr.HTML(label="Field")
188
  text_output = gr.HTML(label="Answer")
189
+ text_button.click(mistral_bot.predict_field, inputs=[text_input], outputs=[field_output], api_name="convert-question")
190
+ text_button.click(mistral_bot.predict_answer, inputs=[text_input, context_input], outputs=[text_output], api_name="convert-code")
191
 
192
  if __name__ == "__main__":
193
  demo.queue().launch()