1- import React , { useState } from " react" ;
2- import { Form , Button , Input , Typography , message } from " antd" ;
3- import UploadModel from " ./components/UploadModel" ;
4- import MethodsSelection from " ./components/MethodsSelection" ;
1+ import React , { useState } from ' react' ;
2+ import { Form , Button , Input , Typography , message } from ' antd' ;
3+ import UploadModel from ' ./components/UploadModel' ;
4+ import MethodsSelection from ' ./components/MethodsSelection' ;
55
66const { Title } = Typography ;
77
@@ -16,37 +16,37 @@ const ComparisonForm: React.FC = () => {
1616
1717 const onFinish = async ( values : FieldType ) => {
1818 if ( ! file ) {
19- message . error ( " Please upload a model file first." ) ;
19+ message . error ( ' Please upload a model file first.' ) ;
2020 return ;
2121 }
2222 if ( methods . length === 0 ) {
23- message . error ( " Please select at least one method." ) ;
23+ message . error ( ' Please select at least one method.' ) ;
2424 return ;
2525 }
2626
2727 const formData = new FormData ( ) ;
28- formData . append ( " file" , file ) ;
29- formData . append ( " experiment" , values . experiment ) ;
30- formData . append ( " email" , values . email ) ;
31- formData . append ( " methods" , JSON . stringify ( methods ) ) ;
28+ formData . append ( ' file' , file ) ;
29+ formData . append ( ' experiment' , values . experiment ) ;
30+ formData . append ( ' email' , values . email ) ;
31+ formData . append ( ' methods' , JSON . stringify ( methods ) ) ;
3232
3333 try {
34- const res = await fetch ( " http://localhost:8000/api/upload" , {
35- method : " POST" ,
34+ const res = await fetch ( ' http://localhost:8000/api/upload' , {
35+ method : ' POST' ,
3636 body : formData ,
3737 } ) ;
38- if ( ! res . ok ) throw new Error ( " Upload failed" ) ;
38+ if ( ! res . ok ) throw new Error ( ' Upload failed' ) ;
3939 const data = await res . json ( ) ;
4040 message . success ( data . message ) ;
4141 console . log ( data ) ;
4242 } catch ( err ) {
4343 console . error ( err ) ;
44- message . error ( " Submission failed" ) ;
44+ message . error ( ' Submission failed' ) ;
4545 }
4646 } ;
4747
4848 const onFinishFailed = ( errorInfo ) => {
49- console . log ( " Failed:" , errorInfo ) ;
49+ console . log ( ' Failed:' , errorInfo ) ;
5050 } ;
5151
5252 return (
@@ -57,32 +57,32 @@ const ComparisonForm: React.FC = () => {
5757 onFinishFailed = { onFinishFailed }
5858 autoComplete = "off"
5959 >
60- < Title level = { 2 } style = { { textAlign : " center" } } >
60+ < Title level = { 2 } style = { { textAlign : ' center' } } >
6161 Comparison of the model with the baseline
6262 </ Title >
6363
6464 < Form . Item
6565 label = "Your experiment name"
6666 name = "experiment"
67- rules = { [ { required : true , message : " Enter experiment name" } ] }
67+ rules = { [ { required : true , message : ' Enter experiment name' } ] }
6868 >
6969 < Input />
7070 </ Form . Item >
7171
72- < Form . Item label = { null } style = { { textAlign : " center" } } >
72+ < Form . Item label = { null } style = { { textAlign : ' center' } } >
7373 < UploadModel onFileChange = { ( f ) => setFile ( f ?. originFileObj || null ) } />
7474 </ Form . Item >
7575
76- < Form . Item label = { null } style = { { textAlign : " center" } } >
76+ < Form . Item label = { null } style = { { textAlign : ' center' } } >
7777 < MethodsSelection onChange = { setMethods } />
7878 </ Form . Item >
7979
8080 < Form . Item
8181 label = "Email"
8282 name = "email"
8383 rules = { [
84- { required : true , message : " Enter email address" } ,
85- { type : " email" , message : " Enter a valid email address" } ,
84+ { required : true , message : ' Enter email address' } ,
85+ { type : ' email' , message : ' Enter a valid email address' } ,
8686 ] }
8787 >
8888 < Input />
0 commit comments