feat: add Select Method field with dummy data options
- Added Select Method dropdown (YOLO, YOLO with VL, SAM 3) - Updated detection row to a responsive 3-column layout - Included select_method in upload API payload
This commit is contained in:
@@ -35,6 +35,7 @@ export default function UploadPage() {
|
|||||||
const [jsonFile, setJsonFile] = useState<File | null>(null)
|
const [jsonFile, setJsonFile] = useState<File | null>(null)
|
||||||
const [speed, setSpeed] = useState(30)
|
const [speed, setSpeed] = useState(30)
|
||||||
const [detectionType, setDetectionType] = useState<DetectionType>("pothole-detection")
|
const [detectionType, setDetectionType] = useState<DetectionType>("pothole-detection")
|
||||||
|
const [selectMethod, setSelectMethod] = useState("yolo")
|
||||||
|
|
||||||
// Upload states
|
// Upload states
|
||||||
const [uploading, setUploading] = useState(false)
|
const [uploading, setUploading] = useState(false)
|
||||||
@@ -108,6 +109,7 @@ export default function UploadPage() {
|
|||||||
formData.append("file", file)
|
formData.append("file", file)
|
||||||
formData.append("detection_type", detectionType)
|
formData.append("detection_type", detectionType)
|
||||||
formData.append("speed_kmh", speed.toString())
|
formData.append("speed_kmh", speed.toString())
|
||||||
|
formData.append("select_method", selectMethod)
|
||||||
if (jsonFile) {
|
if (jsonFile) {
|
||||||
formData.append("json_file", jsonFile)
|
formData.append("json_file", jsonFile)
|
||||||
}
|
}
|
||||||
@@ -236,11 +238,11 @@ export default function UploadPage() {
|
|||||||
</span>
|
</span>
|
||||||
</CardTitle>
|
</CardTitle>
|
||||||
<CardDescription className="text-sm">
|
<CardDescription className="text-sm">
|
||||||
Select video file, detection type, and vehicle speed for analysis
|
Select video file, detection type, vehicle speed, and method for analysis
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="pt-4 space-y-4">
|
<CardContent className="pt-4 space-y-4">
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
||||||
{/* Video File Input */}
|
{/* Video File Input */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="video-file" className="text-sm font-semibold">
|
<Label htmlFor="video-file" className="text-sm font-semibold">
|
||||||
@@ -262,7 +264,7 @@ export default function UploadPage() {
|
|||||||
{/* JSON File Input */}
|
{/* JSON File Input */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="json-file" className="text-sm font-semibold">
|
<Label htmlFor="json-file" className="text-sm font-semibold">
|
||||||
GPS JSON File <span className="text-gray-400 font-normal text-xs">(Optional)</span>
|
GPS JSON File
|
||||||
</Label>
|
</Label>
|
||||||
<Input
|
<Input
|
||||||
id="json-file"
|
id="json-file"
|
||||||
@@ -276,7 +278,10 @@ export default function UploadPage() {
|
|||||||
className="h-10 bg-gray-50 dark:bg-gray-800 file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:bg-blue-100 dark:file:bg-blue-900/50 file:text-blue-600 dark:file:text-blue-400 file:font-medium file:text-xs hover:file:bg-blue-200"
|
className="h-10 bg-gray-50 dark:bg-gray-800 file:mr-3 file:py-1.5 file:px-3 file:rounded-md file:border-0 file:bg-blue-100 dark:file:bg-blue-900/50 file:text-blue-600 dark:file:text-blue-400 file:font-medium file:text-xs hover:file:bg-blue-200"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Detection, Speed, and Method Row */}
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
{/* Detection Type */}
|
{/* Detection Type */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="detection-type" className="text-sm font-semibold">
|
<Label htmlFor="detection-type" className="text-sm font-semibold">
|
||||||
@@ -320,6 +325,33 @@ export default function UploadPage() {
|
|||||||
className="h-10 bg-gray-50 dark:bg-gray-800"
|
className="h-10 bg-gray-50 dark:bg-gray-800"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Select Method */}
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label htmlFor="select-method" className="text-sm font-semibold">
|
||||||
|
Select Method
|
||||||
|
</Label>
|
||||||
|
<Select
|
||||||
|
value={selectMethod}
|
||||||
|
onValueChange={setSelectMethod}
|
||||||
|
disabled={uploading}
|
||||||
|
>
|
||||||
|
<SelectTrigger id="select-method" className="h-10 bg-gray-50 dark:bg-gray-800">
|
||||||
|
<SelectValue placeholder="Select method" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="yolo">
|
||||||
|
<span className="font-medium">YOLO Detection Model</span>
|
||||||
|
</SelectItem>
|
||||||
|
<SelectItem value="yolo-vl">
|
||||||
|
<span className="font-medium">YOLO with Vision-Language Model</span>
|
||||||
|
</SelectItem>
|
||||||
|
<SelectItem value="sam3">
|
||||||
|
<span className="font-medium">OpenAI SAM 3 Segmentation Model</span>
|
||||||
|
</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Error Display */}
|
{/* Error Display */}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export function UploadSection({ onDetectionComplete, onDetectionTypeChange }: Up
|
|||||||
const [jsonFile, setJsonFile] = useState<File | null>(null)
|
const [jsonFile, setJsonFile] = useState<File | null>(null)
|
||||||
const [speed, setSpeed] = useState(30)
|
const [speed, setSpeed] = useState(30)
|
||||||
const [detectionType, setDetectionType] = useState<DetectionType>("pothole-detection")
|
const [detectionType, setDetectionType] = useState<DetectionType>("pothole-detection")
|
||||||
|
const [selectMethod, setSelectMethod] = useState("yolo")
|
||||||
const [uploading, setUploading] = useState(false)
|
const [uploading, setUploading] = useState(false)
|
||||||
const [progress, setProgress] = useState(0)
|
const [progress, setProgress] = useState(0)
|
||||||
const [statusMessage, setStatusMessage] = useState("")
|
const [statusMessage, setStatusMessage] = useState("")
|
||||||
@@ -135,6 +136,7 @@ export function UploadSection({ onDetectionComplete, onDetectionTypeChange }: Up
|
|||||||
formData.append("file", file)
|
formData.append("file", file)
|
||||||
formData.append("detection_type", detectionType)
|
formData.append("detection_type", detectionType)
|
||||||
formData.append("speed_kmh", speed.toString())
|
formData.append("speed_kmh", speed.toString())
|
||||||
|
formData.append("select_method", selectMethod)
|
||||||
|
|
||||||
// Add JSON file if provided
|
// Add JSON file if provided
|
||||||
if (jsonFile) {
|
if (jsonFile) {
|
||||||
@@ -202,11 +204,12 @@ export function UploadSection({ onDetectionComplete, onDetectionTypeChange }: Up
|
|||||||
<CardHeader>
|
<CardHeader>
|
||||||
<CardTitle>Upload Video</CardTitle>
|
<CardTitle>Upload Video</CardTitle>
|
||||||
<CardDescription>
|
<CardDescription>
|
||||||
Select a video file, detection type, and vehicle speed to start AI-powered analysis
|
Select video file, detection type, vehicle speed, and method for analysis
|
||||||
</CardDescription>
|
</CardDescription>
|
||||||
</CardHeader>
|
</CardHeader>
|
||||||
<CardContent className="space-y-4">
|
<CardContent className="space-y-4">
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-4 mb-4">
|
||||||
|
{/* Video File Input kept in 2-col row */}
|
||||||
{/* File Input */}
|
{/* File Input */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="video-file">Video File</Label>
|
<Label htmlFor="video-file">Video File</Label>
|
||||||
@@ -255,6 +258,10 @@ export function UploadSection({ onDetectionComplete, onDetectionTypeChange }: Up
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{/* Detection Type, Speed, and Method - 3 column row */}
|
||||||
|
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
||||||
{/* Detection Type Selector */}
|
{/* Detection Type Selector */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="detection-type">Detection Type</Label>
|
<Label htmlFor="detection-type">Detection Type</Label>
|
||||||
@@ -288,7 +295,7 @@ export function UploadSection({ onDetectionComplete, onDetectionTypeChange }: Up
|
|||||||
|
|
||||||
{/* Speed Input */}
|
{/* Speed Input */}
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label htmlFor="speed">Speed (km/h)</Label>
|
<Label htmlFor="speed">Vehicle Speed (km/h)</Label>
|
||||||
<Input
|
<Input
|
||||||
id="speed"
|
id="speed"
|
||||||
type="number"
|
type="number"
|
||||||
@@ -299,6 +306,37 @@ export function UploadSection({ onDetectionComplete, onDetectionTypeChange }: Up
|
|||||||
disabled={uploading}
|
disabled={uploading}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{/* Select Method */}
|
||||||
|
<div className="space-y-2">
|
||||||
|
<Label htmlFor="select-method">Select Method</Label>
|
||||||
|
<Select
|
||||||
|
value={selectMethod}
|
||||||
|
onValueChange={setSelectMethod}
|
||||||
|
disabled={uploading}
|
||||||
|
>
|
||||||
|
<SelectTrigger id="select-method">
|
||||||
|
<SelectValue placeholder="Select method" />
|
||||||
|
</SelectTrigger>
|
||||||
|
<SelectContent>
|
||||||
|
<SelectItem value="yolo">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span>YOLO</span>
|
||||||
|
</div>
|
||||||
|
</SelectItem>
|
||||||
|
<SelectItem value="yolo-vl">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span>YOLO with VL</span>
|
||||||
|
</div>
|
||||||
|
</SelectItem>
|
||||||
|
<SelectItem value="sam3">
|
||||||
|
<div className="flex items-center gap-2">
|
||||||
|
<span>SAM 3</span>
|
||||||
|
</div>
|
||||||
|
</SelectItem>
|
||||||
|
</SelectContent>
|
||||||
|
</Select>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Error Display */}
|
{/* Error Display */}
|
||||||
|
|||||||
Reference in New Issue
Block a user