Spaces:
Running
Running
chabane
commited on
Commit
·
787c3a2
1
Parent(s):
9846280
add images and modify the main file
Browse files- main.py +10 -3
- static/styles/index.css +3 -1
main.py
CHANGED
@@ -152,10 +152,17 @@ def plot(user_need:str,file:UploadFile=File(...)):
|
|
152 |
if extension not in Supported_extensions:
|
153 |
return JSONResponse(content={"error": "Unsupported file type"},status_code=400)
|
154 |
file_bytes = file.read()
|
155 |
-
if len(file_bytes) > MAX_SIZE :
|
156 |
-
return JSONResponse(content={"error": "too large file "},status_code=400)
|
157 |
-
df = pd.read_excel(io=io.BytesIO(file_bytes))
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
message = f"""
|
160 |
You are a helpful assistant that helps users write Python code.
|
161 |
## Requirements:
|
|
|
152 |
if extension not in Supported_extensions:
|
153 |
return JSONResponse(content={"error": "Unsupported file type"},status_code=400)
|
154 |
file_bytes = file.read()
|
|
|
|
|
|
|
155 |
|
156 |
+
try:
|
157 |
+
|
158 |
+
if len(file_bytes) > MAX_SIZE :
|
159 |
+
return JSONResponse(content={"error": "too large file "},status_code=400)
|
160 |
+
except Exception as expEx:
|
161 |
+
print(expEx)
|
162 |
+
return JSONResponse(content={"error": "error in len "+str(expEx)},status_code=400)
|
163 |
+
|
164 |
+
df = pd.read_excel(io=io.BytesIO(file_bytes))
|
165 |
+
print(df.head())
|
166 |
message = f"""
|
167 |
You are a helpful assistant that helps users write Python code.
|
168 |
## Requirements:
|
static/styles/index.css
CHANGED
@@ -203,6 +203,9 @@ nav {
|
|
203 |
}
|
204 |
}
|
205 |
|
|
|
|
|
|
|
206 |
.about {
|
207 |
padding: 100px 0;
|
208 |
background-color: var(--dark-blue-light);
|
@@ -293,7 +296,6 @@ nav {
|
|
293 |
display: flex;
|
294 |
justify-content: center;
|
295 |
align-items: flex-end;
|
296 |
-
|
297 |
}
|
298 |
|
299 |
.function-link:hover {
|
|
|
203 |
}
|
204 |
}
|
205 |
|
206 |
+
|
207 |
+
|
208 |
+
|
209 |
.about {
|
210 |
padding: 100px 0;
|
211 |
background-color: var(--dark-blue-light);
|
|
|
296 |
display: flex;
|
297 |
justify-content: center;
|
298 |
align-items: flex-end;
|
|
|
299 |
}
|
300 |
|
301 |
.function-link:hover {
|