Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-142
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
2023-142
2023-142
Commits
070c8fc9
Commit
070c8fc9
authored
May 27, 2023
by
IT20013950 Lakshani N.V.M.
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
frontend basics done
parent
189c5d8e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
134 additions
and
23 deletions
+134
-23
frontend/src/Components/NavBar/NavBar.tsx
frontend/src/Components/NavBar/NavBar.tsx
+6
-12
frontend/src/Components/SVM/CounterfactualTable.tsx
frontend/src/Components/SVM/CounterfactualTable.tsx
+53
-0
frontend/src/Components/SVM/Prediction.tsx
frontend/src/Components/SVM/Prediction.tsx
+12
-0
frontend/src/Components/SVM/SVM.tsx
frontend/src/Components/SVM/SVM.tsx
+37
-10
frontend/src/Components/SVM/Sentence.tsx
frontend/src/Components/SVM/Sentence.tsx
+14
-0
frontend/src/Components/_common/ButtonCustom.tsx
frontend/src/Components/_common/ButtonCustom.tsx
+3
-1
frontend/src/Components/_common/Custom
frontend/src/Components/_common/Custom
+0
-0
frontend/src/Components/_common/CustomTitle.tsx
frontend/src/Components/_common/CustomTitle.tsx
+9
-0
No files found.
frontend/src/Components/NavBar/NavBar.tsx
View file @
070c8fc9
...
...
@@ -86,10 +86,10 @@ const useStyles = createStyles((theme) => ({
const
data
=
[
{
link
:
'
/
'
,
label
:
'
Home
'
,
icon
:
HOME_IMG
},
{
link
:
'
/svm
'
,
label
:
'
SVM
'
,
icon
:
SVM_IMG
},
{
link
:
'
/knn
'
,
label
:
'
k-NN
'
,
icon
:
KNN_IMG
},
{
link
:
'
/rf
'
,
label
:
'
Random Forest
'
,
icon
:
RF_IMG
},
{
link
:
'
/lr
'
,
label
:
'
Logistic Regression
'
,
icon
:
LR_IMG
},
{
link
:
'
/svm
'
,
label
:
'
Get Your Rule
'
,
icon
:
SVM_IMG
},
// { link: '/knn', label: 'Documentation
', icon: KNN_IMG },
//
{ link: '/rf', label: 'Random Forest', icon: RF_IMG },
//
{ link: '/lr', label: 'Logistic Regression', icon: LR_IMG },
];
export
function
NavbarSimpleColored
()
{
...
...
@@ -125,21 +125,15 @@ export function NavbarSimpleColored() {
{
links
}
</
Navbar
.
Section
>
<
Navbar
.
Section
className=
{
classes
.
footer
}
>
{
/*
<Navbar.Section className={classes.footer}>
<a href="#" className={classes.link} onClick={(event) => {
event.preventDefault()
navigate("/settings")
}}>
{
/* <IconSwitchHorizontal className={classes.linkIcon} stroke={1.5} /> */
}
<img src={SETTING_IMG} className={classes.linkIcon} />
<span>Settings</span>
</a>
{
/* <a href="#" className={classes.link} onClick={(event) => event.preventDefault()}>
<img src={HOME_IMG} className={classes.linkIcon} />
<span>Logout</span>
</a> */
}
</
Navbar
.
Section
>
</Navbar.Section> */
}
</
Navbar
>
);
}
\ No newline at end of file
frontend/src/Components/SVM/CounterfactualTable.tsx
0 → 100644
View file @
070c8fc9
import
{
Title
,
createStyles
}
from
'
@mantine/core
'
import
React
from
'
react
'
const
useStyle
=
createStyles
((
theme
)
=>
({
table
:
{
border
:
"
1px solid #ddd
"
,
borderCollapse
:
"
collapse
"
,
},
td
:
{
border
:
"
1px solid #ddd
"
,
width
:
window
.
innerHeight
/
4
,
padding
:
"
5px 10px
"
,
},
negative
:
{
border
:
"
1px solid #ddd
"
,
width
:
window
.
innerHeight
/
4
,
padding
:
"
5px 10px
"
,
background
:
"
green
"
,
color
:
"
white
"
,
},
positive
:
{
border
:
"
1px solid #ddd
"
,
width
:
window
.
innerHeight
/
4
,
padding
:
"
5px 10px
"
,
background
:
"
red
"
,
color
:
"
white
"
,
}
}))
function
CounterfactualTable
(
data
:
{
tableData
:
any
})
{
const
{
classes
}
=
useStyle
();
return
(
<
div
>
<
Title
order=
{
6
}
mt=
{
30
}
mb=
{
10
}
>
Results
</
Title
>
<
table
className=
{
classes
.
table
}
>
{
data
.
tableData
.
map
((
e
:
any
,
i
:
number
)
=>
{
return
(
<
tr
key=
{
i
}
>
<
td
className=
{
classes
.
positive
}
>
{
e
.
initial
}
</
td
>
{
i
===
0
?
<
td
className=
{
classes
.
td
}
rowSpan=
{
data
.
tableData
.
length
}
>
Changes to
</
td
>
:
null
}
<
td
className=
{
classes
.
negative
}
>
{
e
.
changedTo
}
</
td
>
</
tr
>
);
})
}
</
table
>
</
div
>
)
}
export
default
CounterfactualTable
\ No newline at end of file
frontend/src/Components/SVM/Prediction.tsx
0 → 100644
View file @
070c8fc9
import
{
Text
,
Title
}
from
'
@mantine/core
'
;
export
function
Prediction
(
data
:
{
prediction
:
string
})
{
return
(
<
div
>
<
Title
order=
{
6
}
mt=
{
60
}
>
Prediction
</
Title
>
<
Text
size=
{
30
}
mt=
{
10
}
>
{
data
.
prediction
}
</
Text
>
</
div
>
);
}
\ No newline at end of file
frontend/src/Components/SVM/SVM.tsx
View file @
070c8fc9
...
...
@@ -3,6 +3,11 @@ import { TextAreaCustom } from "../_common/TextAreaCustom"
import
{
DropDownWidget
}
from
"
../_common/DropDownWidget
"
;
import
{
ButtonCustom
}
from
"
../_common/ButtonCustom
"
;
import
{
ScrollButton
}
from
"
../_common/ScrollButton
"
;
import
{
CustomTitle
}
from
"
../_common/CustomTitle
"
;
import
{
useWindowScroll
}
from
"
@mantine/hooks
"
;
import
{
Sentence
}
from
"
./Sentence
"
;
import
{
Prediction
}
from
"
./Prediction
"
;
import
CounterfactualTable
from
"
./CounterfactualTable
"
;
const
useStyle
=
createStyles
((
theme
)
=>
({
mainContainer
:
{
...
...
@@ -14,19 +19,41 @@ const useStyle = createStyles((theme) => ({
function
SVM
()
{
const
{
classes
}
=
useStyle
();
const
[
scroll
,
scrollTo
]
=
useWindowScroll
();
const
tableData
=
[
{
initial
:
"
like
"
,
changedTo
:
"
do not like
"
},
{
initial
:
"
happy
"
,
changedTo
:
"
sad
"
},
{
initial
:
"
good
"
,
changedTo
:
"
bad
"
},
];
return
(
<
div
className=
{
classes
.
mainContainer
}
>
<
TextAreaCustom
label=
"Enter the review"
placeholder=
"Enter the review"
/>
<
DropDownWidget
label=
"Select the Algorithm"
placeholder=
"Algorithm"
/>
<
ButtonCustom
label=
"Get the rule"
/>
<
ScrollButton
/>
<
div
id=
"getData"
>
<
CustomTitle
title=
"Get Your Rule"
/>
<
TextAreaCustom
label=
"Enter the review"
placeholder=
"Enter the review"
/>
<
DropDownWidget
label=
"Select the Algorithm"
placeholder=
"Algorithm"
/>
<
ButtonCustom
label=
"Get the rule"
onClick=
{
()
=>
scrollTo
({
y
:
window
.
innerHeight
})
}
/>
<
ScrollButton
/>
</
div
>
<
div
id=
"viewResult"
style=
{
{
width
:
window
.
innerWidth
/
5
*
3
,
height
:
window
.
innerHeight
}
}
>
<
CustomTitle
title=
"Counterfactual Result"
/>
<
Sentence
sentence=
"I like apple"
hightLightWords=
{
[
"
like
"
]
}
/>
<
Prediction
prediction=
"Positive"
/>
<
CounterfactualTable
tableData=
{
tableData
}
/>
</
div
>
</
div
>
)
}
...
...
frontend/src/Components/SVM/Sentence.tsx
0 → 100644
View file @
070c8fc9
import
{
Highlight
,
Text
,
Title
}
from
'
@mantine/core
'
;
export
function
Sentence
(
data
:
{
sentence
:
string
,
hightLightWords
:
string
[]})
{
return
(
<
div
>
<
Title
order=
{
6
}
mt=
{
30
}
>
Sentence
</
Title
>
<
Text
size=
{
30
}
mt=
{
10
}
>
<
Highlight
highlight=
{
data
.
hightLightWords
}
>
{
data
.
sentence
}
</
Highlight
>
</
Text
>
</
div
>
);
}
\ No newline at end of file
frontend/src/Components/_common/ButtonCustom.tsx
View file @
070c8fc9
...
...
@@ -8,7 +8,7 @@ const useStyles = createStyles((theme) => ({
}
}))
export
function
ButtonCustom
(
data
:
{
label
:
string
})
{
export
function
ButtonCustom
(
data
:
{
label
:
string
,
onClick
:
any
})
{
const
{
classes
}
=
useStyles
()
return
(
...
...
@@ -19,6 +19,8 @@ export function ButtonCustom(data: {label: string}) {
radius=
"xl"
size=
"lg"
mt=
{
30
}
mb=
{
100
}
onClick=
{
data
.
onClick
}
>
{
data
.
label
}
</
Button
>
...
...
frontend/src/Components/_common/Custom
deleted
100644 → 0
View file @
189c5d8e
frontend/src/Components/_common/CustomTitle.tsx
0 → 100644
View file @
070c8fc9
import
{
Title
}
from
'
@mantine/core
'
;
export
function
CustomTitle
(
data
:
{
title
:
string
})
{
return
(
<>
<
Title
order=
{
1
}
align=
'left'
mt=
{
50
}
>
{
data
.
title
}
</
Title
>
</>
);
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment