Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
2023-113
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-113
2023-113
Commits
e2287506
Commit
e2287506
authored
May 25, 2023
by
Madusanka-w
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Display crops
parent
58b9e083
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
1 deletion
+20
-1
Weather Analyzer and Crop Reccomender-IT20151874/RP-MobileAPP-FE/components/weatherCrop/Crops.js
...T20151874/RP-MobileAPP-FE/components/weatherCrop/Crops.js
+20
-1
No files found.
Weather Analyzer and Crop Reccomender-IT20151874/RP-MobileAPP-FE/components/weatherCrop/Crops.js
View file @
e2287506
...
...
@@ -7,7 +7,26 @@ const Crops = ({ route }) => {
const
[
isLoading
,
setIsLoading
]
=
useState
(
false
);
const
[
suitableCrop
,
setSuitableCrop
]
=
useState
(
null
);
useEffect
(()
=>
{
const
fetchCropData
=
async
()
=>
{
console
.
log
(
"
params
"
,
typeof
userInputs
.
temperature
)
setIsLoading
(
true
);
try
{
const
response
=
await
axios
.
post
(
'
http://127.0.0.1:5000/predict
'
,
{
temperature
:
userInputs
.
temperature
,
humidity
:
userInputs
.
humidity
});
const
responseData
=
response
.
data
;
setSuitableCrop
(
responseData
);
}
catch
(
error
)
{
console
.
error
(
'
Error fetching crop data:
'
,
error
);
}
finally
{
setIsLoading
(
false
);
}
};
fetchCropData
();
},
[]);
console
.
log
(
"
output
"
,
suitableCrop
)
return
(
<
ImageBackground
...
...
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