Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -166,18 +166,20 @@ elif tabs == 'Reports':
|
|
166 |
# Display filtered DataFrame
|
167 |
st.write("Filtered DataFrame")
|
168 |
with st.expander("Preview"):
|
169 |
-
st.write(filtered_df)
|
170 |
-
|
|
|
171 |
You are an expert business analyst. Analyze the following data and generate a comprehensive and insightful business report, including appropriate key perfomance indicators and reccomendations.
|
172 |
|
173 |
data:
|
174 |
""" + str(calculate_kpis(filtered_df)) + str(get_pandas_profile(filtered_df))
|
175 |
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
|
|
182 |
|
183 |
|
|
|
166 |
# Display filtered DataFrame
|
167 |
st.write("Filtered DataFrame")
|
168 |
with st.expander("Preview"):
|
169 |
+
st.write(filtered_df.head())
|
170 |
+
with st.spinner("Generating Report, Please Wait...."):
|
171 |
+
prompt = """
|
172 |
You are an expert business analyst. Analyze the following data and generate a comprehensive and insightful business report, including appropriate key perfomance indicators and reccomendations.
|
173 |
|
174 |
data:
|
175 |
""" + str(calculate_kpis(filtered_df)) + str(get_pandas_profile(filtered_df))
|
176 |
|
177 |
+
response = model.generate_content(prompt)
|
178 |
+
report = response.text
|
179 |
+
st.markdown(report)
|
180 |
+
st.success("Report Generated!")
|
181 |
+
else:
|
182 |
+
st.write("Filtered DataFrame")
|
183 |
+
st.write("Click 'Apply Filters' to see the filtered data.")
|
184 |
|
185 |
|