Upload chat_functions.py
Browse filesProvide specific example questions for example data to help guide the demo
- functions/chat_functions.py +19 -5
functions/chat_functions.py
CHANGED
|
@@ -89,6 +89,24 @@ with gr.Blocks(css=css) as demo:
|
|
| 89 |
def data_options(filename, request: gr.Request):
|
| 90 |
print(filename)
|
| 91 |
if filename:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
parameters = gr.Textbox(visible=False, value=request.session_hash)
|
| 93 |
bot = gr.Chatbot(type='messages', label="CSV Chat Window", show_label=True, render=False, visible=True, elem_classes="chatbot")
|
| 94 |
chat = gr.ChatInterface(
|
|
@@ -97,11 +115,7 @@ with gr.Blocks(css=css) as demo:
|
|
| 97 |
chatbot=bot,
|
| 98 |
title="Chat with your data file",
|
| 99 |
concurrency_limit=None,
|
| 100 |
-
examples=
|
| 101 |
-
["Describe the dataset"],
|
| 102 |
-
["List the columns in the dataset"],
|
| 103 |
-
["What could this data be used for?"],
|
| 104 |
-
],
|
| 105 |
additional_inputs=parameters
|
| 106 |
)
|
| 107 |
process_upload(filename, request.session_hash)
|
|
|
|
| 89 |
def data_options(filename, request: gr.Request):
|
| 90 |
print(filename)
|
| 91 |
if filename:
|
| 92 |
+
if "bank_marketing_campaign" in filename:
|
| 93 |
+
example_questions = [
|
| 94 |
+
["Describe the dataset"],
|
| 95 |
+
["What levels of education have the highest and lowest average balance?"],
|
| 96 |
+
["What job is most and least common for a yes response from the individuals, not counting 'unknown'?"],
|
| 97 |
+
]
|
| 98 |
+
elif "online_retail_data" in filename:
|
| 99 |
+
example_questions = [
|
| 100 |
+
["Describe the dataset"],
|
| 101 |
+
["What month had the highest revenue?"],
|
| 102 |
+
["Is revenue higher in the morning or afternoon?"],
|
| 103 |
+
]
|
| 104 |
+
else:
|
| 105 |
+
example_questions = [
|
| 106 |
+
["Describe the dataset"],
|
| 107 |
+
["List the columns in the dataset"],
|
| 108 |
+
["What could this data be used for?"],
|
| 109 |
+
]
|
| 110 |
parameters = gr.Textbox(visible=False, value=request.session_hash)
|
| 111 |
bot = gr.Chatbot(type='messages', label="CSV Chat Window", show_label=True, render=False, visible=True, elem_classes="chatbot")
|
| 112 |
chat = gr.ChatInterface(
|
|
|
|
| 115 |
chatbot=bot,
|
| 116 |
title="Chat with your data file",
|
| 117 |
concurrency_limit=None,
|
| 118 |
+
examples=example_questions,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 119 |
additional_inputs=parameters
|
| 120 |
)
|
| 121 |
process_upload(filename, request.session_hash)
|