DrishtiSharma commited on
Commit
5d45f1f
Β·
verified Β·
1 Parent(s): 91943f9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -22
app.py CHANGED
@@ -87,28 +87,28 @@ if st.session_state.df is not None and st.session_state.show_preview:
87
  st.dataframe(st.session_state.df.head())
88
 
89
 
90
- """def ask_gpt4o_for_visualization(query, df, llm):
91
- columns = ', '.join(df.columns)
92
- prompt = f"""
93
- Analyze the query and suggest one or more relevant visualizations.
94
- Query: "{query}"
95
- Available Columns: {columns}
96
- Respond in this JSON format (as a list if multiple suggestions):
97
- [
98
- {{
99
- "chart_type": "bar/box/line/scatter",
100
- "x_axis": "column_name",
101
- "y_axis": "column_name",
102
- "group_by": "optional_column_name"
103
- }}
104
- ]
105
- """
106
- response = llm.generate(prompt)
107
- try:
108
- return json.loads(response)
109
- except json.JSONDecodeError:
110
- st.error("⚠️ GPT-4o failed to generate a valid suggestion.")
111
- return None"""
112
 
113
  def ask_gpt4o_for_visualization(query, df, llm, retries=2):
114
  import json
 
87
  st.dataframe(st.session_state.df.head())
88
 
89
 
90
+ #def ask_gpt4o_for_visualization(query, df, llm):
91
+ # columns = ', '.join(df.columns)
92
+ # prompt = f"""
93
+ # Analyze the query and suggest one or more relevant visualizations.
94
+ # Query: "{query}"
95
+ # Available Columns: {columns}
96
+ # Respond in this JSON format (as a list if multiple suggestions):
97
+ # [
98
+ # {{
99
+ # "chart_type": "bar/box/line/scatter",
100
+ # "x_axis": "column_name",
101
+ # "y_axis": "column_name",
102
+ # "group_by": "optional_column_name"
103
+ # }}
104
+ # ]
105
+ # """
106
+ # response = llm.generate(prompt)
107
+ # try:
108
+ # return json.loads(response)
109
+ # except json.JSONDecodeError:
110
+ # st.error("⚠️ GPT-4o failed to generate a valid suggestion.")
111
+ # return None
112
 
113
  def ask_gpt4o_for_visualization(query, df, llm, retries=2):
114
  import json