MsChabane commited on
Commit
cdbc8d2
·
verified ·
1 Parent(s): 76d2071

change interpreter

Browse files
Files changed (1) hide show
  1. main.py +25 -25
main.py CHANGED
@@ -51,7 +51,7 @@ def caption(file:UploadFile=File(...)):
51
  if extension not in Supported_extensions:
52
  return {"error": "Unsupported file type"}
53
  image = Image.open(file.file)
54
- interpreter = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
55
  caption = interpreter(image)
56
  return {"caption": caption[0]['generated_text']}
57
 
@@ -86,30 +86,30 @@ def plot(prompt:str,file:UploadFile=File(...)):
86
  return {"error": "Unsupported file type"}
87
  df = pd.read_excel(file.file)
88
  message = f"""
89
- You are a helpful assistant that helps users write Python code.
90
- ## Requirements:
91
- -you will be given a task and you will write the code to solve the task.
92
- -you have a dataset called **df** contains the following information:
93
- df.columns:{df.columns.to_list()}
94
- df.dtypes:{df.dtypes.to_dict()}
95
-
96
- -you have to write the code to solve the task using the dataset df.
97
- -you can use pandas to manipulate the dataframe.
98
- -you can use matplotlib to plot the data.
99
- -you can use seaborn to plot the data.
100
- -don't use print or input statements in the code.
101
- -don't use any other libraries except pandas, matplotlib, seaborn.
102
- -don't use any other functions except the ones provided in the libraries.
103
- -don't write the code for the dataframe creation.
104
- -exclude plt.show() from the code.
105
- -you have to write the code in a markdown code block.
106
- -make sure that the type of the chart is compatible with the dtypes of the columns
107
- -use only the column specified in the task.
108
- -you have to extract the column names and the plot type from the prompt bellow and use them in the code.
109
- -if the user task is not clear or there is an error like the column names are not in the dataframe, raise an
110
- error.
111
-
112
- ##Prompt: {prompt}.
113
  """
114
  generator = pipeline("text-generation", model="deepseek-ai/deepseek-coder-1.3b-instruct", device_map="auto")
115
  output = generator(message, max_length=1000)
 
51
  if extension not in Supported_extensions:
52
  return {"error": "Unsupported file type"}
53
  image = Image.open(file.file)
54
+ interpreter = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large")
55
  caption = interpreter(image)
56
  return {"caption": caption[0]['generated_text']}
57
 
 
86
  return {"error": "Unsupported file type"}
87
  df = pd.read_excel(file.file)
88
  message = f"""
89
+ You are a helpful assistant that helps users write Python code.
90
+ ## Requirements:
91
+ -you will be given a task and you will write the code to solve the task.
92
+ -you have a dataset called **df** contains the following information:
93
+ df.columns:{df.columns.to_list()}
94
+ df.dtypes:{df.dtypes.to_dict()}
95
+
96
+ -you have to write the code to solve the task using the dataset df.
97
+ -you can use pandas to manipulate the dataframe.
98
+ -you can use matplotlib to plot the data.
99
+ -you can use seaborn to plot the data.
100
+ -don't use print or input statements in the code.
101
+ -don't use any other libraries except pandas, matplotlib, seaborn.
102
+ -don't use any other functions except the ones provided in the libraries.
103
+ -don't write the code for the dataframe creation.
104
+ -exclude plt.show() from the code.
105
+ -you have to write the code in a markdown code block.
106
+ -make sure that the type of the chart is compatible with the dtypes of the columns
107
+ -use only the column specified in the task.
108
+ -you have to extract the column names and the plot type from the prompt bellow and use them in the code.
109
+ -if the user task is not clear or there is an error like the column names are not in the dataframe, raise an
110
+ error.
111
+
112
+ ##Prompt: {prompt}.
113
  """
114
  generator = pipeline("text-generation", model="deepseek-ai/deepseek-coder-1.3b-instruct", device_map="auto")
115
  output = generator(message, max_length=1000)