Spaces:
Sleeping
Sleeping
kellydoesstuff
commited on
Commit
•
f49a294
1
Parent(s):
97dd292
Update app.py
Browse files
app.py
CHANGED
@@ -95,16 +95,16 @@ def query_model(question, history):
|
|
95 |
"""
|
96 |
Process a question, find relevant information, and generate a response.
|
97 |
"""
|
98 |
-
global question_g
|
99 |
-
question_g = question
|
100 |
if question == "":
|
101 |
return "What the sigma! You didn't ask a question. Feel free to ask me anything about the topics listed above."
|
102 |
relevant_segment = find_relevant_segment(question, segments)
|
103 |
if not relevant_segment:
|
104 |
return "Unfortunately I cannot answer your question..😔 Try refining your question so I can try again."
|
105 |
-
global response_g
|
106 |
-
|
107 |
-
return
|
108 |
|
109 |
# Define the welcome message and specific topics the chatbot can provide information about
|
110 |
welcome_message = """
|
@@ -143,8 +143,8 @@ with gr.Blocks(theme='gradio/soft') as demo:
|
|
143 |
with gr.Row():
|
144 |
flag_btn = gr.Button("Flag")
|
145 |
|
146 |
-
callback.setup([
|
147 |
-
flag_btn.click(lambda *args: callback.flag(args), [
|
148 |
|
149 |
# Launch the Gradio app to allow user interaction
|
150 |
demo.launch(share=True)
|
|
|
95 |
"""
|
96 |
Process a question, find relevant information, and generate a response.
|
97 |
"""
|
98 |
+
# global question_g
|
99 |
+
# question_g = question
|
100 |
if question == "":
|
101 |
return "What the sigma! You didn't ask a question. Feel free to ask me anything about the topics listed above."
|
102 |
relevant_segment = find_relevant_segment(question, segments)
|
103 |
if not relevant_segment:
|
104 |
return "Unfortunately I cannot answer your question..😔 Try refining your question so I can try again."
|
105 |
+
# global response_g
|
106 |
+
response = generate_response(question, relevant_segment)
|
107 |
+
return response
|
108 |
|
109 |
# Define the welcome message and specific topics the chatbot can provide information about
|
110 |
welcome_message = """
|
|
|
143 |
with gr.Row():
|
144 |
flag_btn = gr.Button("Flag")
|
145 |
|
146 |
+
callback.setup([chatbot], "flagged_data_points")
|
147 |
+
flag_btn.click(lambda *args: callback.flag(args), [chatbot], None, preprocess=False)
|
148 |
|
149 |
# Launch the Gradio app to allow user interaction
|
150 |
demo.launch(share=True)
|