Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -83,6 +83,7 @@ if st.session_state.df is not None and st.session_state.show_preview:
|
|
| 83 |
st.subheader("π Dataset Preview")
|
| 84 |
st.dataframe(st.session_state.df.head())
|
| 85 |
|
|
|
|
| 86 |
# SQL-RAG Analysis
|
| 87 |
if st.session_state.df is not None:
|
| 88 |
temp_dir = tempfile.TemporaryDirectory()
|
|
@@ -141,14 +142,14 @@ if st.session_state.df is not None:
|
|
| 141 |
|
| 142 |
analyze_data = Task(
|
| 143 |
description="Analyze the extracted data for query: {query}.",
|
| 144 |
-
expected_output="Analysis text summarizing findings
|
| 145 |
agent=data_analyst,
|
| 146 |
context=[extract_data],
|
| 147 |
)
|
| 148 |
|
| 149 |
write_report = Task(
|
| 150 |
-
description="Summarize the analysis into an executive report without
|
| 151 |
-
expected_output="Markdown report of insights without
|
| 152 |
agent=report_writer,
|
| 153 |
context=[analyze_data],
|
| 154 |
)
|
|
@@ -168,12 +169,14 @@ if st.session_state.df is not None:
|
|
| 168 |
query = st.text_area("Enter Query:", value="Provide insights into the salary of a Principal Data Scientist.")
|
| 169 |
if st.button("Submit Query"):
|
| 170 |
with st.spinner("Processing query..."):
|
| 171 |
-
# Step 1: Generate Report
|
| 172 |
-
|
|
|
|
| 173 |
report_result = crew.kickoff(inputs=inputs)
|
| 174 |
|
| 175 |
-
# Step 2: Generate
|
| 176 |
-
|
|
|
|
| 177 |
conclusion_result = crew.kickoff(inputs=conclusion_inputs)
|
| 178 |
|
| 179 |
st.markdown("### Analysis Report:")
|
|
|
|
| 83 |
st.subheader("π Dataset Preview")
|
| 84 |
st.dataframe(st.session_state.df.head())
|
| 85 |
|
| 86 |
+
# SQL-RAG Analysis
|
| 87 |
# SQL-RAG Analysis
|
| 88 |
if st.session_state.df is not None:
|
| 89 |
temp_dir = tempfile.TemporaryDirectory()
|
|
|
|
| 142 |
|
| 143 |
analyze_data = Task(
|
| 144 |
description="Analyze the extracted data for query: {query}.",
|
| 145 |
+
expected_output="Analysis text summarizing findings without any conclusion, summary, or final remarks.",
|
| 146 |
agent=data_analyst,
|
| 147 |
context=[extract_data],
|
| 148 |
)
|
| 149 |
|
| 150 |
write_report = Task(
|
| 151 |
+
description="Summarize the analysis into an executive report without any conclusion, summary, or closing statements.",
|
| 152 |
+
expected_output="Markdown report of insights without any conclusion.",
|
| 153 |
agent=report_writer,
|
| 154 |
context=[analyze_data],
|
| 155 |
)
|
|
|
|
| 169 |
query = st.text_area("Enter Query:", value="Provide insights into the salary of a Principal Data Scientist.")
|
| 170 |
if st.button("Submit Query"):
|
| 171 |
with st.spinner("Processing query..."):
|
| 172 |
+
# Step 1: Generate Report WITHOUT Conclusion, Summary, or Closing Remarks
|
| 173 |
+
report_prompt = f"{query} Provide a detailed analysis but DO NOT include any Conclusion, Summary, or closing remarks."
|
| 174 |
+
inputs = {"query": report_prompt}
|
| 175 |
report_result = crew.kickoff(inputs=inputs)
|
| 176 |
|
| 177 |
+
# Step 2: Generate ONLY the Conclusion
|
| 178 |
+
conclusion_prompt = f"{query} Provide only the Conclusion for this analysis."
|
| 179 |
+
conclusion_inputs = {"query": conclusion_prompt}
|
| 180 |
conclusion_result = crew.kickoff(inputs=conclusion_inputs)
|
| 181 |
|
| 182 |
st.markdown("### Analysis Report:")
|