Update Demo.py
Browse files
Demo.py
CHANGED
@@ -69,9 +69,8 @@ def create_pipeline(model):
|
|
69 |
def fit_data(pipeline, json_data, question):
|
70 |
spark_df = spark.createDataFrame([[json_data, question]]).toDF("table_json", "questions")
|
71 |
model = pipeline.fit(spark_df)
|
72 |
-
|
73 |
-
|
74 |
-
pan
|
75 |
|
76 |
# Sidebar content
|
77 |
model = st.sidebar.selectbox(
|
@@ -173,10 +172,10 @@ output = fit_data(pipeline, table_json_str, text_to_analyze)
|
|
173 |
st.markdown("---")
|
174 |
st.subheader("Processed Output")
|
175 |
|
176 |
-
#
|
177 |
-
|
178 |
-
#
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
|
|
69 |
def fit_data(pipeline, json_data, question):
|
70 |
spark_df = spark.createDataFrame([[json_data, question]]).toDF("table_json", "questions")
|
71 |
model = pipeline.fit(spark_df)
|
72 |
+
res = model.transform(spark_df)
|
73 |
+
return res.select("answers_wtq.result", "answers_sqa.result").collect()
|
|
|
74 |
|
75 |
# Sidebar content
|
76 |
model = st.sidebar.selectbox(
|
|
|
172 |
st.markdown("---")
|
173 |
st.subheader("Processed Output")
|
174 |
|
175 |
+
# Check if output is available
|
176 |
+
if output:
|
177 |
+
# Extract and Display results
|
178 |
+
results_wtq = output[0][0] if output[0][0] else "No results found."
|
179 |
+
results_sqa = output[0][1] if output[0][1] else "No results found."
|
180 |
+
st.markdown(f"**Answers from WTQ model:** {', '.join(results_wtq)}")
|
181 |
+
st.markdown(f"**Answers from SQA model:** {', '.join(results_sqa)}")
|