kellydoesstuff commited on
Commit
3a0fd58
·
verified ·
1 Parent(s): cca14df

Updated ChatInterface

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -84,7 +84,7 @@ def generate_response(user_query, relevant_segment):
84
  print(f"Error in generating response: {e}")
85
  return f"Error in generating response: {e}"
86
 
87
- def query_model(question):
88
  """
89
  Process a question, find relevant information, and generate a response.
90
  """
@@ -122,11 +122,17 @@ with gr.Blocks(theme='gradio/soft') as demo:
122
  # answer = gr.Textbox(label="ChessBot Response", placeholder="RotBot will respond here...", interactive=False, lines=10)
123
  # submit_button = gr.Button("Submit")
124
  # submit_button.click(fn=query_model, inputs=question, outputs=answer)
125
- gr.ChatInterface(
126
- fn = query_model,
127
- multimodal = False,
128
- examples = [{"text": "Help me translate this sentence into standard English: "}, {"text": "Here's the context to this sentence: "}]
 
 
 
 
 
129
  )
 
130
 
131
 
132
  # Launch the Gradio app to allow user interaction
 
84
  print(f"Error in generating response: {e}")
85
  return f"Error in generating response: {e}"
86
 
87
+ def query_model(question, history):
88
  """
89
  Process a question, find relevant information, and generate a response.
90
  """
 
122
  # answer = gr.Textbox(label="ChessBot Response", placeholder="RotBot will respond here...", interactive=False, lines=10)
123
  # submit_button = gr.Button("Submit")
124
  # submit_button.click(fn=query_model, inputs=question, outputs=answer)
125
+ # gr.ChatInterface(
126
+ # fn = query_model,
127
+ # multimodal = False,
128
+ # examples = [{"text": "Help me translate this sentence into standard English: "}, {"text": "Here's the context to this sentence: "}]
129
+ # )
130
+ chatbot = gr.ChatInterface(
131
+ fn=query_model,
132
+ examples=[{"text": "hello"}, {"text": "hola"}, {"text": "merhaba"}],
133
+ multimodal=False
134
  )
135
+ chatbot.launch()
136
 
137
 
138
  # Launch the Gradio app to allow user interaction