location based ml part intregration

parent fcfefc9f
......@@ -61,6 +61,49 @@ def hotel():
# Location Based Hotel Prediction
def predictionHotelLB(lst):
filename = 'model/HotelLocationSuccessPredictor.pickle'
with open(filename, 'rb') as file:
model = pickle.load(file)
pred_value = model.predict([lst]).tolist()
return pred_value
@app.route('/hotelLocationBase', methods=['POST', 'GET'])
def hotelLB():
pred=0
if request.method == 'POST':
Attraction_Place = request.json['AttractionPlace']
Transportation_Modes = request.json['TransportationModes']
NearByHotelReviewCount = request.json['NearByHotelReviewCount']
CompetitorsCount = request.json['CompetitorsCount']
if ( isinstance(Attraction_Place, int) and isinstance(Transportation_Modes, int) ):
feature_list = []
feature_list.append(int(CompetitorsCount))
feature_list.append(int(Transportation_Modes))
feature_list.append(int(Attraction_Place))
feature_list.append(int(NearByHotelReviewCount))
pred = predictionHotelLB(feature_list)
print(pred)
return jsonify({'data': pred[0]})
else :
if(not isinstance(Attraction_Place, int)):
return jsonify({'Error': "Acttraction Places Are Missing !"})
else :
return jsonify({'Error': "Transportation Modes Are Missing!"})
#Restaurant API
def predictionRestaurant(lst):
......@@ -109,6 +152,57 @@ def restaurant():
return jsonify({'Error': "Distance To City Is Missing!"})
# Location Based Restaurant API
def predictionRestaurantLB(lst):
filename = 'model/RestaurantRatingSuccessPredicto.pickle'
with open(filename, 'rb') as file:
model = pickle.load(file)
pred_value = model.predict([lst]).tolist()
return pred_value
@app.route('/restaurantLocationBase', methods=['POST', 'GET'])
def restaurantLB():
if request.method == 'POST':
ShoppingMallsCount = request.json['ShoppingMallsCount']
EducationRelatedPlacesCount = request.json['EducationRelatedPlacesCount']
WorkPlacesCount = request.json['WorkPlacesCount']
CompetitorsCount = request.json['CompetitorsCount']
DistanceToCity = request.json['DistanceToCity']
if ( isinstance(ShoppingMallsCount, int) and (isinstance(DistanceToCity, float) or isinstance(DistanceToCity, int) ) ):
feature_list = []
feature_list.append(int(ShoppingMallsCount))
feature_list.append(int(EducationRelatedPlacesCount))
feature_list.append(int(WorkPlacesCount))
feature_list.append(int(CompetitorsCount))
feature_list.append(float(DistanceToCity))
# if(isinstance(Distance_ToCity, float)):
# feature_list.append(float(Distance_ToCity))
# else:
# feature_list.append(int(Distance_ToCity))
pred = predictionRestaurantLB(feature_list)
print(pred)
return jsonify({'data': pred[0]})
else :
if(not isinstance(ShoppingMallsCount, int)):
return jsonify({'Error': "Shoping Area's Are Missing !"})
else :
return jsonify({'Error': "Distance To City Is Missing!"})
#Pharmacy API
def predictionPharmacy(lst):
......
......@@ -6859,6 +6859,11 @@
"slash": "^3.0.0"
}
},
"goober": {
"version": "2.1.11",
"resolved": "https://registry.npmjs.org/goober/-/goober-2.1.11.tgz",
"integrity": "sha512-5SS2lmxbhqH0u9ABEWq7WPU69a4i2pYcHeCxqaNq6Cw3mnrF0ghWNM4tEGid4dKy8XNIAUbuThuozDHHKJVh3A=="
},
"google-maps-infobox": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/google-maps-infobox/-/google-maps-infobox-2.0.0.tgz",
......@@ -11083,6 +11088,14 @@
"resolved": "https://registry.npmjs.org/react-chartjs-2/-/react-chartjs-2-4.3.1.tgz",
"integrity": "sha512-5i3mjP6tU7QSn0jvb8I4hudTzHJqS8l00ORJnVwI2sYu0ihpj83Lv2YzfxunfxTZkscKvZu2F2w9LkwNBhj6xA=="
},
"react-cssfx-loading": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/react-cssfx-loading/-/react-cssfx-loading-2.1.0.tgz",
"integrity": "sha512-0SnS6HpaeLSaTxNuND6sAKTQmoKgjwFb9G2ltyEMmA5ARNN6TRQfiJ8PfaYM9RwVEOhDxIzGI7whb2zeI1VRxw==",
"requires": {
"goober": "^2.1.10"
}
},
"react-csv": {
"version": "2.2.2",
"resolved": "https://registry.npmjs.org/react-csv/-/react-csv-2.2.2.tgz",
......@@ -11402,6 +11415,11 @@
"prop-types": "^15.6.2"
}
},
"react-type-animation": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/react-type-animation/-/react-type-animation-2.1.1.tgz",
"integrity": "sha512-leXq9tZLsfbQWi+1PvsSc2XZYv9CqRrChvuv81M0UPECggBEQgplQzTO9LzgjYNPdnhf4UMeEtZMI4G1qPpuwA=="
},
"readable-stream": {
"version": "3.6.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz",
......
......@@ -28,6 +28,7 @@
"react": "^18.1.0",
"react-animated-3d-card": "^1.0.2",
"react-chartjs-2": "^4.3.1",
"react-cssfx-loading": "^2.1.0",
"react-csv": "^2.2.2",
"react-csv-reader": "^3.5.0",
"react-dom": "^18.1.0",
......@@ -44,6 +45,7 @@
"react-router": "^6.3.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"react-type-animation": "^2.1.1",
"redux": "^4.2.0",
"tsparticles": "^2.3.1",
"typescript": "^4.6.4",
......
......@@ -24,6 +24,7 @@ import SignIn from './components/Auth/SignIn';
import BusinessTypePage from './components/BusinessTypePage';
import MultipleResult from './components/MultipleResult';
import ResultsWOTypes from './components/ResultsWOTypes';
import LocationBasedPredict from './components/LocationBasedPredict';
const store = configureStore({
reducer: {
......@@ -55,6 +56,7 @@ function App() {
<Route path="/multipleResult" element={<MultipleResult/>} />
<Route path="/resultWOTypes" element={<ResultsWOTypes/>} />
<Route path="/Service" element={<BusinessTypePage />} />
<Route path="/locationBasedPredict" element={<LocationBasedPredict />} />
</Route>
</Routes>
<Footer />
......
......@@ -21,6 +21,7 @@ import ContactUs from './components/ContactUs';
import Loader from './components/Loader';
//import API from '../../Backend/src/api';
const containerStyle = {
width: '1400px',
height: '500px'
......
......@@ -102,6 +102,11 @@ const BusinessTypePage = () => {
dispatch(addBusiness({ 'type': 'restaurant' }))
navigate(`/inputHotel`)
}
const navigateToLocationBasedPredic = () => {
dispatch(addBusiness({ 'type': 'locationBased' }))
navigate(`/locationBasedPredict`)
}
return (
<Box
sx={{
......@@ -256,7 +261,7 @@ return (
<div className={classes.bodyText}>
We make sure your website looks the way you want it to where ever it is viewed. In this day and age there smart devices populate our entire life, We strive to ensure that the websites we create are always up to standard with the new devices releasing all the time. We develop dynamic websites based on our client requests such as Content Management System (CMS), E-commerce websites (Shopping carts), Online Bookings, Web Portals, Payment Gateways etc. There are many uses of having a dynamic site.
</div>
<GetStarted variant="contained" endIcon={<ArrowForwardIosIcon />}>
<GetStarted variant="contained" endIcon={<ArrowForwardIosIcon />} onClick={() => navigateToLocationBasedPredic()} >
Get Started
</GetStarted>
</Box>
......@@ -422,7 +427,7 @@ return (
<div className={classes.bodyText}>
We make sure your website looks the way you want it to where ever it is viewed. In this day and age there smart devices populate our entire life, We strive to ensure that the websites we create are always up to standard with the new devices releasing all the time. We develop dynamic websites based on our client requests such as Content Management System (CMS), E-commerce websites (Shopping carts), Online Bookings, Web Portals, Payment Gateways etc. There are many uses of having a dynamic site.
</div>
<GetStarted variant="contained" onClick={() => navigateToHInputForm()} endIcon={<ArrowForwardIosIcon />}>
<GetStarted variant="contained" onClick={() => navigateToRInputForm()} endIcon={<ArrowForwardIosIcon />}>
Get Started
</GetStarted>
</Box>
......
......@@ -23,6 +23,8 @@ import Backdrop from '@mui/material/Backdrop';
import CircularProgress from '@mui/material/CircularProgress';
import { useNavigate } from "react-router-dom";
import styled from '@emotion/styled';
import { FillingBottle } from "react-cssfx-loading";
import { TypeAnimation } from 'react-type-animation';
const NextBtn = styled(Button)(() => ({
......@@ -303,20 +305,65 @@ export default function InputDetails() {
</Stepper>
<React.Fragment>
{activeStep === steps.length ? (
<Backdrop
sx={{ color: '#fff', zIndex: (theme) => theme.zIndex.drawer + 1 }}
open={open}
onClick={handleClose}
>
// <Backdrop
// sx={{ color: '#000', zIndex: (theme) => theme.zIndex.drawer + 1 }}
// open={open}
// onClick={handleClose}
// >
<React.Fragment>
<Typography variant="h5" gutterBottom>
{/* <Typography variant="h5" gutterBottom>
Finalizing the Result.
</Typography>
<CircularProgress color="inherit" />
<CircularProgress color="inherit" /> */}
<Box
sx={{
display: 'flex',
alignItems: 'center',
flexDirection: 'column',
justifyContent: 'center',
backgroundColor: '#65646e',
color: 'black',
gap: 2,
width: '100%',
height: '100%',
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
boxSizing: 'border-box',
backgroundImage:'url(https://images.unsplash.com/photo-1478860409698-8707f313ee8b?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1170&q=80)',
padding:"10px",
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
backgroundBlendMode: 'overlay',
}}
>
<FillingBottle color="#101554" width="50px" height="50px" duration="3s" />
<TypeAnimation
sequence={[
'Loading', // Types 'One'
2000, // Waits 1s
'Analyzing', // Deletes 'One' and types 'Two'
4000, // Waits 2s
'Finalizing the Result.', // Types 'Three' without deleting 'Two'
() => {
console.log('Done typing!'); // Place optional callbacks anywhere in the array
}
]}
wrapper="div"
cursor={true}
repeat={Infinity}
style={{ fontSize: '2em',color:"#101554" }}
/>
</Box>
</React.Fragment>
</Backdrop>
// </Backdrop>
) : (
<React.Fragment>
{getStepContent(activeStep)}
......
......@@ -18,6 +18,7 @@ const InputHotelDetails = () => {
backgroundRepeat: 'no-repeat',
backgroundSize: 'cover',
backgroundAttachment:'fixed',
}}
>
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment