Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-323
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
1
Merge Requests
1
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-323
2023-323
Commits
651c9571
Commit
651c9571
authored
Oct 03, 2023
by
Kareshaan Logeswaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
created It20236946 frontend2
parent
9b167041
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
0 deletions
+75
-0
api 2/css/styles.css
api 2/css/styles.css
+45
-0
api 2/js/main.js
api 2/js/main.js
+30
-0
No files found.
api 2/css/styles.css
0 → 100644
View file @
651c9571
/* Add general styles here */
body
{
font-family
:
Arial
,
sans-serif
;
background-color
:
#f8f9fa
;
}
.container
{
margin-top
:
50px
;
}
/* Style the header */
h1
{
color
:
#343a40
;
}
/* Style the form */
.form-label
{
font-weight
:
bold
;
}
.btn-primary
{
background-color
:
#007bff
;
border-color
:
#007bff
;
}
/* Style the result container */
#result
{
border
:
1px
solid
#ddd
;
padding
:
10px
;
margin-top
:
20px
;
background-color
:
#fff
;
}
/* Add more styles as needed */
/* Add your custom CSS styles here */
.container
{
max-width
:
600px
;
margin
:
0
auto
;
text-align
:
center
;
}
.btn-primary
:hover
{
transform
:
scale
(
1.1
);
transition
:
transform
0.2s
ease-in-out
;
}
api 2/js/main.js
0 → 100644
View file @
651c9571
// DOM elements
const
uploadForm
=
document
.
getElementById
(
"
uploadForm
"
);
const
imageInput
=
document
.
getElementById
(
"
imageInput
"
);
const
result
=
document
.
getElementById
(
"
result
"
);
const
predictedClass
=
document
.
getElementById
(
"
predictedClass
"
);
const
confidence
=
document
.
getElementById
(
"
confidence
"
);
// Event listener for form submission
uploadForm
.
addEventListener
(
"
submit
"
,
(
e
)
=>
{
e
.
preventDefault
();
const
formData
=
new
FormData
();
formData
.
append
(
"
file
"
,
imageInput
.
files
[
0
]);
// Send the image to the backend for prediction
fetch
(
"
/predict
"
,
{
method
:
"
POST
"
,
body
:
formData
,
})
.
then
((
response
)
=>
response
.
json
())
.
then
((
data
)
=>
{
// Display the prediction result
predictedClass
.
textContent
=
`Predicted Class:
${
data
.
class
}
`
;
confidence
.
textContent
=
`Confidence:
${
data
.
confidence
.
toFixed
(
2
)}
`
;
result
.
style
.
display
=
"
block
"
;
})
.
catch
((
error
)
=>
{
console
.
error
(
"
Error:
"
,
error
);
});
});
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