Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
E
EmidWife-New
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-24-005
EmidWife-New
Commits
eded323f
Commit
eded323f
authored
May 21, 2024
by
Malsha Jayakody
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new changes
parent
fbc714d4
Changes
2
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
754 additions
and
691 deletions
+754
-691
src/screens/home/skin/AdditionalSymptoms.js
src/screens/home/skin/AdditionalSymptoms.js
+453
-414
src/screens/home/skin/SkinUploader.js
src/screens/home/skin/SkinUploader.js
+301
-277
No files found.
src/screens/home/skin/AdditionalSymptoms.js
View file @
eded323f
This diff is collapsed.
Click to expand it.
src/screens/home/skin/SkinUploader.js
View file @
eded323f
import
React
,
{
useState
}
from
'
react
'
;
import
{
View
,
StyleSheet
,
Image
,
TouchableOpacity
,
PermissionsAndroid
,
Text
,
ScrollView
}
from
'
react-native
'
;
import
{
launchCamera
,
launchImageLibrary
}
from
'
react-native-image-picker
'
;
import
{
COLORS
,
IMGS
,
ROUTES
}
from
'
../../../constants
'
;
import
React
,
{
useState
}
from
'
react
'
;
import
{
View
,
StyleSheet
,
Image
,
TouchableOpacity
,
PermissionsAndroid
,
Text
,
ScrollView
,
ActivityIndicator
,
}
from
'
react-native
'
;
import
{
launchCamera
,
launchImageLibrary
}
from
'
react-native-image-picker
'
;
import
{
COLORS
,
IMGS
,
ROUTES
}
from
'
../../../constants
'
;
import
Button
from
'
../../../components/Button
'
;
import
axios
from
'
axios
'
;
// Import Axios
const
Camera
=
({
navigation
})
=>
{
const
Camera
=
({
navigation
})
=>
{
const
[
cameraPhoto
,
setCameraPhoto
]
=
useState
();
const
[
galleryPhoto
,
setGalleryPhoto
]
=
useState
();
const
REACT_APP_API_URL
=
'
https://us-central1-skin-condition-detection.cloudfunctions.net/predict
'
;
const
REACT_APP_API_URL
=
'
https://us-central1-skin-condition-detection.cloudfunctions.net/predict
'
;
const
[
prediction
,
setPrediction
]
=
useState
(
null
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
photo
,
setPhoto
]
=
useState
(
null
);
let
options
=
{
saveToPhotos
:
true
,
mediaType
:
'
photo
'
,
...
...
@@ -41,7 +49,7 @@ const Camera = ({ navigation }) => {
}
};
const
submitPhoto
=
async
(
photoUri
)
=>
{
const
submitPhoto
=
async
photoUri
=>
{
try
{
const
formData
=
new
FormData
();
formData
.
append
(
'
file
'
,
{
...
...
@@ -66,7 +74,6 @@ const Camera = ({ navigation }) => {
}
};
const
handleContinue
=
()
=>
{
let
route
;
// Variable to store the route name
...
...
@@ -98,13 +105,11 @@ const Camera = ({ navigation }) => {
}
else
{
// Handle the scenario where prediction or prediction.class is undefined
// Maybe navigate to an error page or show an alert
console
.
log
(
"
No valid prediction available.
"
);
console
.
log
(
'
No valid prediction available.
'
);
// navigation.navigate(ROUTES.DEFAULT_ROUTE); // Example fallback
}
};
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
topContainer
}
>
...
...
@@ -113,31 +118,49 @@ const Camera = ({ navigation }) => {
<
Image
style
=
{
styles
.
babyImage
}
source
=
{
IMGS
.
sk_1
}
/
>
<
View
style
=
{
styles
.
buttonContainer
}
>
<
TouchableOpacity
onPress
=
{
openGallery
}
style
=
{[
styles
.
button
,
styles
.
buttonLeft
]}
>
<
TouchableOpacity
onPress
=
{
openGallery
}
style
=
{[
styles
.
button
,
styles
.
buttonLeft
]}
>
<
Image
source
=
{
IMGS
.
sk_3
}
style
=
{
styles
.
buttonImage
}
/
>
<
/TouchableOpacity
>
<
TouchableOpacity
onPress
=
{
openCamera
}
style
=
{[
styles
.
button
,
styles
.
buttonRight
]}
>
<
TouchableOpacity
onPress
=
{
openCamera
}
style
=
{[
styles
.
button
,
styles
.
buttonRight
]}
>
<
Image
source
=
{
IMGS
.
sk_2
}
style
=
{
styles
.
buttonImage
}
/
>
<
/TouchableOpacity
>
<
/View
>
{
photo
&&
(
<
View
style
=
{
styles
.
photoContainer
}
>
<
Image
source
=
{{
uri
:
photo
}}
style
=
{
styles
.
photo
}
/
>
<
Image
source
=
{{
uri
:
photo
}}
style
=
{
styles
.
photo
}
/
>
<
/View
>
)}
<
/View
>
<
Text
style
=
{
styles
.
descriptionText
}
>
'
Use phone camera or select a photo from the gallery that clearly shows your skin.
'
<
/Text
>
<
Text
style
=
{
styles
.
descriptionText
}
>
'
Use phone camera or select a photo from the gallery that clearly shows
your skin.
'
<
/Text
>
<
View
style
=
{
styles
.
bottomContainer
}
>
{
loading
?
(
<
View
style
=
{
styles
.
loaderContainer
}
>
<
ActivityIndicator
size
=
"
large
"
color
=
{
COLORS
.
primary
}
/
>
<
/View
>
)
:
(
<>
{
!
prediction
&&
(
<>
<
Text
style
=
{
styles
.
resultsHeading
}
>
Results
will
appear
below
<
/Text
>
<
Text
style
=
{
styles
.
resultsHeading
}
>
Results
will
appear
below
<
/Text
>
<
/
>
)}
{
prediction
&&
(
{
!
loading
&&
prediction
&&
(
<
View
style
=
{
styles
.
predictionContainer
}
>
<
Text
style
=
{
styles
.
predictionText
}
>
Diagnosed
Condition
|
හඳුනාගත්
සමේ
ආසාදනය
:
{
prediction
.
class
}
<
/Text
>
<
Text
style
=
{
styles
.
predictionText
}
>
How
sure
are
we
|
නිරවද්යතාව
:
{
prediction
.
confidence
}
<
/Text
>
<
Text
style
=
{
styles
.
predictionText
}
>
Diagnosed
Condition
|
හඳුනාගත්
සමේ
ආසාදනය
:
{
prediction
.
class
}
<
/Text
>
<
Text
style
=
{
styles
.
predictionText
}
>
How
sure
are
we
|
නිරවද්යතාව
:
{
prediction
.
confidence
}
<
/Text
>
<
/View
>
)}
<
Button
...
...
@@ -145,6 +168,8 @@ const Camera = ({ navigation }) => {
style
=
{
styles
.
nextButton
}
onPress
=
{
handleContinue
}
/
>
<
/
>
)}
<
/View
>
<
/View
>
);
...
...
@@ -170,7 +195,6 @@ const styles = StyleSheet.create({
// This creates the curve effect for the background
},
buttonContainer
:
{
flexDirection
:
'
row
'
,
marginTop
:
-
26
,
...
...
@@ -225,18 +249,17 @@ const styles = StyleSheet.create({
textAlign
:
'
center
'
,
marginHorizontal
:
10
,
marginBottom
:
-
10
,
marginTop
:
-
40
marginTop
:
-
40
,
},
bottomContainer
:
{
flex
:
2
,
justifyContent
:
'
flex-end
'
,
marginBottom
:
2
,
marginTop
:
20
,
marginTop
:
20
,
alignItems
:
'
center
'
,
backgroundColor
:
COLORS
.
blue
,
borderTopRightRadius
:
75
,
borderTopLeftRadius
:
75
,
},
nextButton
:
{
width
:
'
90%
'
,
...
...
@@ -245,13 +268,12 @@ const styles = StyleSheet.create({
backgroundColor
:
COLORS
.
white
,
borderRadius
:
20
,
alignSelf
:
'
center
'
,
},
photoContainer
:
{
elevation
:
4
,
// Android shadow
shadowColor
:
'
#000
'
,
// iOS shadow
shadowOffset
:
{
width
:
0
,
height
:
2
},
// iOS shadow
shadowOffset
:
{
width
:
0
,
height
:
2
},
// iOS shadow
shadowOpacity
:
0.1
,
// iOS shadow
shadowRadius
:
2
,
// iOS shadow
borderRadius
:
10
,
...
...
@@ -276,11 +298,11 @@ const styles = StyleSheet.create({
// Add shadows if you like for better visual separation
elevation
:
4
,
// Android shadow
shadowColor
:
'
#000
'
,
// iOS shadow
shadowOffset
:
{
width
:
0
,
height
:
2
},
// iOS shadow
shadowOffset
:
{
width
:
0
,
height
:
2
},
// iOS shadow
shadowOpacity
:
0.1
,
// iOS shadow
shadowRadius
:
2
,
// iOS shadow
bottom
:
75
,
top
:
-
10
bottom
:
75
,
top
:
-
10
,
},
resultsHeading
:
{
fontSize
:
16
,
...
...
@@ -289,18 +311,20 @@ const styles = StyleSheet.create({
padding
:
10
,
textAlign
:
'
center
'
,
marginBottom
:
90
,
marginLeft
:
0
marginLeft
:
0
,
},
resultImage
:
{
width
:
100
,
// Set your desired width
height
:
100
,
// Set your desired height
alignSelf
:
'
center
'
,
marginVertical
:
20
,
// Adjust margin as needed
},
});
loaderContainer
:
{
flex
:
1
,
justifyContent
:
'
center
'
,
alignItems
:
'
center
'
,
},
});
export
default
Camera
;
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