chabane commited on
Commit
de12321
·
1 Parent(s): 3e4d72f

Final commit

Browse files
Files changed (2) hide show
  1. main.py +1 -26
  2. static/scripts/data-visualisation.js +2 -2
main.py CHANGED
@@ -165,32 +165,7 @@ async def plot(user_need:str=Form(...),file:UploadFile=File(...)):
165
 
166
  df = pd.read_excel(io=io.BytesIO(file_bytes))
167
 
168
- # message = f"""
169
- #You are a helpful assistant that helps users write Python code.
170
- ### Requirements:
171
- #-you will be given a task and you will write the code to solve the task.
172
- #-you have a dataset called **df** contains the following information:
173
- #df.columns:{df.columns.to_list()}
174
- #df.dtypes:{df.dtypes.to_dict()}
175
- #
176
- #-you have to write the code to solve the task using the dataset df.
177
- #-you can use pandas to manipulate the dataframe.
178
- #-you can use matplotlib to plot the data.
179
- #-you can use seaborn to plot the data.
180
- #-don't use print or input statements in the code.
181
- #-don't use any other libraries except pandas, matplotlib, seaborn.
182
- #-don't use any other functions except the ones provided in the libraries.
183
- #-don't write the code for the dataframe creation.
184
- #-check if the columns has a nan values and raise exception if yes .
185
- #-exclude plt.show() from the code.
186
- #-you have to write the code in a markdown code block.
187
- #-make sure that the type of the chart is compatible with the dtypes of the columns
188
- #-use only the column specified in the task.
189
- #-you have to extract the column names and the plot type from the prompt bellow and use them in the code.
190
- #-if the user task is not clear or there is an error like the column names are not in the dataframe, raise an
191
- #error.
192
- ###Prompt: {user_need}.
193
- # """
194
  prompt = [
195
  {"role": "system", "content": f'''You are a helpful assistant that helps users write Python code.
196
  -you have to write the code to solve the task using the dataset df.
 
165
 
166
  df = pd.read_excel(io=io.BytesIO(file_bytes))
167
 
168
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  prompt = [
170
  {"role": "system", "content": f'''You are a helpful assistant that helps users write Python code.
171
  -you have to write the code to solve the task using the dataset df.
static/scripts/data-visualisation.js CHANGED
@@ -62,8 +62,8 @@ document.addEventListener("DOMContentLoaded", function () {
62
  });
63
 
64
  newVisualizationBtn.addEventListener("click", function () {
65
- fileInput.files = [];
66
- //fileName.textContent = "No Data chosen";
67
  promptInput.value = "";
68
  resultsSection.style.display = "none";
69
 
 
62
  });
63
 
64
  newVisualizationBtn.addEventListener("click", function () {
65
+ fileInput.files[0] = null;
66
+
67
  promptInput.value = "";
68
  resultsSection.style.display = "none";
69