Spaces:
Sleeping
Sleeping
fix
Browse files
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 🚀
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: red
|
| 6 |
sdk: docker
|
| 7 |
-
app_port:
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
|
|
|
| 4 |
colorFrom: blue
|
| 5 |
colorTo: red
|
| 6 |
sdk: docker
|
| 7 |
+
app_port: 7860
|
| 8 |
pinned: false
|
| 9 |
---
|
| 10 |
|
frontend/src/pages/AnalyticsPage/AnalyticsPage.tsx
CHANGED
|
@@ -237,7 +237,7 @@ export default function AnalyticsPage() {
|
|
| 237 |
count,
|
| 238 |
percentage: Math.round((count / data.totalCaptions) * 100)
|
| 239 |
}));
|
| 240 |
-
}, [data,
|
| 241 |
|
| 242 |
const sourcesTableData = useMemo(() => {
|
| 243 |
if (!data) return [];
|
|
@@ -250,7 +250,7 @@ export default function AnalyticsPage() {
|
|
| 250 |
count,
|
| 251 |
percentage: Math.round((count / data.totalCaptions) * 100)
|
| 252 |
}));
|
| 253 |
-
}, [data,
|
| 254 |
|
| 255 |
const modelsTableData = useMemo(() => {
|
| 256 |
if (!data) return [];
|
|
|
|
| 237 |
count,
|
| 238 |
percentage: Math.round((count / data.totalCaptions) * 100)
|
| 239 |
}));
|
| 240 |
+
}, [data, getTypeLabel]);
|
| 241 |
|
| 242 |
const sourcesTableData = useMemo(() => {
|
| 243 |
if (!data) return [];
|
|
|
|
| 250 |
count,
|
| 251 |
percentage: Math.round((count / data.totalCaptions) * 100)
|
| 252 |
}));
|
| 253 |
+
}, [data, getSourceLabel]);
|
| 254 |
|
| 255 |
const modelsTableData = useMemo(() => {
|
| 256 |
if (!data) return [];
|
frontend/src/pages/UploadPage/UploadPage.tsx
CHANGED
|
@@ -43,11 +43,11 @@ export default function UploadPage() {
|
|
| 43 |
stepRef.current = step;
|
| 44 |
uploadedImageIdRef.current = uploadedImageId;
|
| 45 |
|
| 46 |
-
const handleSourceChange = (value:
|
| 47 |
-
const handleEventTypeChange = (value:
|
| 48 |
-
const handleEpsgChange = (value:
|
| 49 |
-
const handleImageTypeChange = (value:
|
| 50 |
-
const handleCountriesChange = (value:
|
| 51 |
|
| 52 |
const handleStepChange = (newStep: 1 | '2a' | '2b' | 3) => {
|
| 53 |
setStep(newStep);
|
|
@@ -243,7 +243,7 @@ export default function UploadPage() {
|
|
| 243 |
if (dropped) setFile(dropped);
|
| 244 |
};
|
| 245 |
|
| 246 |
-
const onFileChange = (file: File | undefined
|
| 247 |
if (file) setFile(file);
|
| 248 |
};
|
| 249 |
|
|
@@ -258,7 +258,7 @@ export default function UploadPage() {
|
|
| 258 |
}, [file]);
|
| 259 |
|
| 260 |
|
| 261 |
-
async function readJsonSafely(res: Response): Promise<
|
| 262 |
const text = await res.text();
|
| 263 |
try {
|
| 264 |
return text ? JSON.parse(text) : {};
|
|
@@ -267,9 +267,8 @@ export default function UploadPage() {
|
|
| 267 |
}
|
| 268 |
}
|
| 269 |
|
| 270 |
-
function handleApiError(err:
|
| 271 |
-
|
| 272 |
-
const message = err.message || `Failed to ${operation.toLowerCase()}`;
|
| 273 |
alert(message);
|
| 274 |
}
|
| 275 |
|
|
@@ -542,7 +541,7 @@ export default function UploadPage() {
|
|
| 542 |
type="file"
|
| 543 |
accept="image/*"
|
| 544 |
className="sr-only"
|
| 545 |
-
|
| 546 |
/>
|
| 547 |
<Button
|
| 548 |
name="upload"
|
|
|
|
| 43 |
stepRef.current = step;
|
| 44 |
uploadedImageIdRef.current = uploadedImageId;
|
| 45 |
|
| 46 |
+
const handleSourceChange = (value: string | undefined) => setSource(value || '');
|
| 47 |
+
const handleEventTypeChange = (value: string | undefined) => setEventType(value || '');
|
| 48 |
+
const handleEpsgChange = (value: string | undefined) => setEpsg(value || '');
|
| 49 |
+
const handleImageTypeChange = (value: string | undefined) => setImageType(value || '');
|
| 50 |
+
const handleCountriesChange = (value: string[] | undefined) => setCountries(Array.isArray(value) ? value : []);
|
| 51 |
|
| 52 |
const handleStepChange = (newStep: 1 | '2a' | '2b' | 3) => {
|
| 53 |
setStep(newStep);
|
|
|
|
| 243 |
if (dropped) setFile(dropped);
|
| 244 |
};
|
| 245 |
|
| 246 |
+
const onFileChange = (file: File | undefined) => {
|
| 247 |
if (file) setFile(file);
|
| 248 |
};
|
| 249 |
|
|
|
|
| 258 |
}, [file]);
|
| 259 |
|
| 260 |
|
| 261 |
+
async function readJsonSafely(res: Response): Promise<Record<string, unknown>> {
|
| 262 |
const text = await res.text();
|
| 263 |
try {
|
| 264 |
return text ? JSON.parse(text) : {};
|
|
|
|
| 267 |
}
|
| 268 |
}
|
| 269 |
|
| 270 |
+
function handleApiError(err: unknown, operation: string) {
|
| 271 |
+
const message = err instanceof Error ? err.message : `Failed to ${operation.toLowerCase()}`;
|
|
|
|
| 272 |
alert(message);
|
| 273 |
}
|
| 274 |
|
|
|
|
| 541 |
type="file"
|
| 542 |
accept="image/*"
|
| 543 |
className="sr-only"
|
| 544 |
+
onChange={e => onFileChange(e.target.files?.[0])}
|
| 545 |
/>
|
| 546 |
<Button
|
| 547 |
name="upload"
|
frontend/vite.config.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { defineConfig } from 'vite'
|
|
| 2 |
import react from '@vitejs/plugin-react'
|
| 3 |
|
| 4 |
export default defineConfig({
|
|
|
|
| 5 |
plugins: [react()],
|
| 6 |
server: {
|
| 7 |
proxy: {
|
|
|
|
| 2 |
import react from '@vitejs/plugin-react'
|
| 3 |
|
| 4 |
export default defineConfig({
|
| 5 |
+
base: '/app/',
|
| 6 |
plugins: [react()],
|
| 7 |
server: {
|
| 8 |
proxy: {
|