Spaces:
Sleeping
Sleeping
Commit ·
fcc8c39
1
Parent(s): 9ddf356
Prepare frontend for Vercel deployment
Browse files- frontend/.env.example +1 -0
- frontend/src/App.tsx +2 -1
- frontend/vercel.json +9 -0
frontend/.env.example
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
VITE_API_URL=https://your-huggingface-space-url.hf.space
|
frontend/src/App.tsx
CHANGED
|
@@ -180,8 +180,9 @@ function Dashboard() {
|
|
| 180 |
const formData = new FormData();
|
| 181 |
formData.append("file", selectedFile);
|
| 182 |
|
|
|
|
| 183 |
try {
|
| 184 |
-
const response = await fetch(
|
| 185 |
method: "POST",
|
| 186 |
body: formData,
|
| 187 |
});
|
|
|
|
| 180 |
const formData = new FormData();
|
| 181 |
formData.append("file", selectedFile);
|
| 182 |
|
| 183 |
+
const API_URL = import.meta.env.VITE_API_URL || "";
|
| 184 |
try {
|
| 185 |
+
const response = await fetch(`${API_URL}/predict`, {
|
| 186 |
method: "POST",
|
| 187 |
body: formData,
|
| 188 |
});
|
frontend/vercel.json
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Vercel Configuration for frontend
|
| 2 |
+
{
|
| 3 |
+
"version": 2,
|
| 4 |
+
"framework": "vite",
|
| 5 |
+
"name": "oil-spill-detection-ui",
|
| 6 |
+
"installCommand": "npm install",
|
| 7 |
+
"buildCommand": "npm run build",
|
| 8 |
+
"outputDirectory": "dist"
|
| 9 |
+
}
|