Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
240
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
2022-240
240
Commits
de86a677
Commit
de86a677
authored
May 07, 2022
by
Malsha Rathnasiri
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tts part
parent
b733b112
Changes
29
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
8664 additions
and
8148 deletions
+8664
-8148
.gitignore
.gitignore
+1
-0
MobileApp/authentication/Authentication.js
MobileApp/authentication/Authentication.js
+147
-0
MobileApp/components/AudioRecorder.jsx
MobileApp/components/AudioRecorder.jsx
+82
-0
MobileApp/components/loginForm.jsx
MobileApp/components/loginForm.jsx
+0
-0
MobileApp/navigation/index.tsx
MobileApp/navigation/index.tsx
+25
-5
MobileApp/package.json
MobileApp/package.json
+6
-1
MobileApp/screens/TabOneScreen.tsx
MobileApp/screens/TabOneScreen.tsx
+20
-3
MobileApp/screens/TabTwoScreen.tsx
MobileApp/screens/TabTwoScreen.tsx
+1
-3
MobileApp/screens/loginScreen.js
MobileApp/screens/loginScreen.js
+96
-0
MobileApp/types.tsx
MobileApp/types.tsx
+1
-0
MobileApp/yarn.lock
MobileApp/yarn.lock
+7554
-7513
README.md
README.md
+39
-39
backend/.gitignore
backend/.gitignore
+1
-1
backend/backend/asgi.py
backend/backend/asgi.py
+16
-16
backend/backend/cms/admin.py
backend/backend/cms/admin.py
+3
-3
backend/backend/cms/apps.py
backend/backend/cms/apps.py
+6
-6
backend/backend/cms/migrations/0001_initial.py
backend/backend/cms/migrations/0001_initial.py
+23
-23
backend/backend/cms/model/predict.py
backend/backend/cms/model/predict.py
+51
-46
backend/backend/cms/model/train.py
backend/backend/cms/model/train.py
+209
-209
backend/backend/cms/models.py
backend/backend/cms/models.py
+8
-8
backend/backend/cms/serializers.py
backend/backend/cms/serializers.py
+21
-21
backend/backend/cms/tests.py
backend/backend/cms/tests.py
+3
-3
backend/backend/cms/views.py
backend/backend/cms/views.py
+139
-67
backend/backend/settings.py
backend/backend/settings.py
+157
-129
backend/backend/urls.py
backend/backend/urls.py
+17
-14
backend/backend/wsgi.py
backend/backend/wsgi.py
+16
-16
backend/db_old.sqlite3
backend/db_old.sqlite3
+0
-0
backend/manage.py
backend/manage.py
+22
-22
requirements.txt
requirements.txt
+0
-0
No files found.
.gitignore
0 → 100644
View file @
de86a677
venv/
MobileApp/authentication/Authentication.js
0 → 100644
View file @
de86a677
import
React
,
{
createContext
,
useContext
,
useState
,
useEffect
,
useLayoutEffect
}
from
"
react
"
;
import
{
nexlAxios
}
from
"
../../constants/helper
"
;
import
AsyncStorage
from
"
@react-native-community/async-storage
"
;
import
{
IAuthContext
,
IAuthRequest
,
STORAGE_BEARER_TOKEN
,
UNINITIALISED
,
USER_EMAIL
,
}
from
"
./IAuthContext
"
;
import
{
Loading
}
from
"
./state/Loading
"
;
import
{
getEnvironment
}
from
"
../../constants/variables
"
;
import
{
AxiosError
,
AxiosResponse
}
from
"
axios
"
;
import
{
rollbar
}
from
"
./ErrorBoundary
"
;
const
AuthContext
=
createContext
({
isLoggedIn
:
false
,
token
:
""
,
email
:
""
,
error
:
""
,
loading
:
false
,
initialised
:
false
,
login
:
UNINITIALISED
,
logout
:
UNINITIALISED
,
});
export
const
useAuthContext
=
()
=>
useContext
(
AuthContext
);
export
const
AuthConsumer
=
AuthContext
.
Consumer
;
// interface IProps {
// children: any;
// }
// interface ILoginData {
// error: string;
// user: {
// email: string;
// id: string;
// first_name: string;
// last_name: string;
// };
// }
const
endpoint
=
getEnvironment
().
endpoint
;
export
const
AuthProvider
=
({
children
})
=>
{
const
[
isLoggedIn
,
setIsLoggedIn
]
=
useState
(
false
);
const
[
token
,
setToken
]
=
useState
(
""
);
const
[
email
,
setEmail
]
=
useState
(
""
);
const
[
error
,
setError
]
=
useState
(
""
);
const
[
loading
,
setLoading
]
=
useState
(
false
);
const
[
initialised
,
setInitialised
]
=
useState
(
false
);
const
login
=
async
({
email
,
password
,
rememberMe
})
=>
{
setLoading
(
true
);
nexlAxios
(
false
)
.
post
(
`
${
endpoint
}
/accounts/sign_in.json`
,
{
source
:
"
iOS app
"
,
account
:
{
email
,
password
,
remember_me
:
rememberMe
?
"
1
"
:
"
0
"
,
},
})
.
then
(
async
(
response
)
=>
{
setLoading
(
false
);
const
user
=
response
.
data
.
user
;
user
.
email
&&
setIsLoggedIn
(
true
);
const
token
=
response
.
headers
[
"
authorization
"
];
setToken
(
token
);
await
AsyncStorage
.
setItem
(
USER_EMAIL
,
email
);
setEmail
(
email
);
rollbar
.
setPerson
(
user
.
id
,
`
${
user
.
first_name
}
${
user
.
last_name
}
`
,
user
.
email
);
})
.
catch
((
result
)
=>
{
setLoading
(
false
);
setError
(
result
?.
response
?.
data
?.
error
||
result
?.
message
||
"
An unknown error has occurred.
"
,
);
});
};
const
loginWithBearerToken
=
async
(
bearer
)
=>
{
if
(
bearer
)
{
setLoading
(
true
);
await
nexlAxios
(
false
,
bearer
)
.
post
(
`
${
endpoint
}
/accounts/sign_in.json`
,
undefined
,
{
headers
:
{
Authorization
:
bearer
,
},
})
.
then
((
response
)
=>
{
setLoading
(
false
);
const
user
=
response
.
data
.
user
;
user
.
email
&&
setIsLoggedIn
(
true
);
rollbar
.
setPerson
(
user
.
id
,
`
${
user
.
first_name
}
${
user
.
last_name
}
`
,
user
.
email
);
})
.
catch
(()
=>
{
setLoading
(
false
);
setToken
(
""
);
});
}
};
const
logout
=
async
()
=>
{
const
token
=
await
AsyncStorage
.
getItem
(
STORAGE_BEARER_TOKEN
);
token
&&
(
await
nexlAxios
(
false
,
token
).
post
(
`
${
endpoint
}
/sign_out.json`
));
setToken
(
""
);
setIsLoggedIn
(
false
);
await
AsyncStorage
.
removeItem
(
STORAGE_BEARER_TOKEN
);
rollbar
.
clearPerson
();
};
// look if token / email exist in local storage on initialising the app
// if token exists, try log in with token
useLayoutEffect
(()
=>
{
let
isMounted
=
true
;
const
initialise
=
async
()
=>
{
const
bearerToken
=
await
AsyncStorage
.
getItem
(
STORAGE_BEARER_TOKEN
);
setToken
(
bearerToken
||
""
);
const
userEmail
=
await
AsyncStorage
.
getItem
(
USER_EMAIL
);
setEmail
(
userEmail
||
""
);
bearerToken
&&
(
await
loginWithBearerToken
(
bearerToken
));
setInitialised
(
true
);
};
if
(
isMounted
)
{
initialise
();
}
return
()
=>
{
isMounted
=
false
;
};
},
[]);
// update token to local storage on token change
useEffect
(()
=>
{
AsyncStorage
.
setItem
(
STORAGE_BEARER_TOKEN
,
token
);
},
[
token
]);
return
(
<
AuthContext
.
Provider
value
=
{{
login
,
isLoggedIn
,
logout
,
token
,
email
:
email
.
toLowerCase
(),
loading
,
error
,
initialised
,
}}
>
{
initialised
?
children
:
<
Loading
copy
=
"
Logging in...
"
/>
}
<
/AuthContext.Provider
>
);
};
\ No newline at end of file
MobileApp/components/AudioRecorder.jsx
0 → 100644
View file @
de86a677
import
React
from
'
react
'
import
{
Text
,
View
,
StyleSheet
,
Button
}
from
'
react-native
'
;
import
{
Audio
}
from
'
expo-av
'
;
import
{
createIconSetFromFontello
}
from
'
@expo/vector-icons
'
;
import
*
as
FileSystem
from
'
expo-file-system
'
;
export
const
AudioRecorder
=
({
setDetectedText
})
=>
{
const
[
recording
,
setRecording
]
=
React
.
useState
();
const
[
sound
,
setSound
]
=
React
.
useState
();
async
function
startRecording
()
{
try
{
console
.
log
(
'
Requesting permissions..
'
);
await
Audio
.
requestPermissionsAsync
();
await
Audio
.
setAudioModeAsync
({
allowsRecordingIOS
:
true
,
playsInSilentModeIOS
:
true
,
});
console
.
log
(
'
Starting recording..
'
);
const
{
recording
}
=
await
Audio
.
Recording
.
createAsync
(
Audio
.
RECORDING_OPTIONS_PRESET_HIGH_QUALITY
);
setRecording
(
recording
);
console
.
log
(
'
Recording started
'
);
}
catch
(
err
)
{
console
.
error
(
'
Failed to start recording
'
,
err
);
}
}
async
function
stopRecording
()
{
console
.
log
(
'
Stopping recording..
'
);
setRecording
(
undefined
);
await
recording
.
stopAndUnloadAsync
();
const
uri
=
recording
.
getURI
();
console
.
log
(
'
Recording stopped and stored at
'
,
uri
);
console
.
log
(
recording
)
const
headers
=
{
'
Content-Type
'
:
'
multipart/form-data
'
// 'Content-Type': 'application/x-www-form-urlencoded',
}
playSound
(
uri
)
FileSystem
.
uploadAsync
(
"
https://1ec4-112-134-210-155.ap.ngrok.io/mlmodels/detect/
"
,
uri
,
{
headers
:
headers
,
uploadType
:
FileSystem
.
FileSystemUploadType
.
MULTIPART
})
.
then
(
data
=>
JSON
.
parse
(
data
.
body
))
.
then
(
data
=>
{
console
.
log
({
result
:
data
});
setDetectedText
(
data
.
result
);
setTimeout
(()
=>
setDetectedText
(
''
),
1000
)
})
.
catch
(
err
=>
console
.
log
({
err
}))
}
async
function
playSound
(
uri
)
{
console
.
log
(
'
Loading Sound
'
);
// const { sound } = await Audio.Sound.createAsync(
// require(uri)
// );
// setSound(sound);
// console.log('Playing Sound');
// await sound.playAsync();
}
return
(
<
Button
style=
{
{
height
:
'
100%
'
,
padding
:
5
}
}
title=
{
recording
?
'
Stop Recording
'
:
'
Start Recording
'
}
onPress=
{
recording
?
stopRecording
:
startRecording
}
/>
);
}
\ No newline at end of file
MobileApp/components/loginForm.jsx
0 → 100644
View file @
de86a677
MobileApp/navigation/index.tsx
View file @
de86a677
...
@@ -12,6 +12,7 @@ import { ColorSchemeName, Pressable } from 'react-native';
...
@@ -12,6 +12,7 @@ import { ColorSchemeName, Pressable } from 'react-native';
import
Colors
from
'
../constants/Colors
'
;
import
Colors
from
'
../constants/Colors
'
;
import
useColorScheme
from
'
../hooks/useColorScheme
'
;
import
useColorScheme
from
'
../hooks/useColorScheme
'
;
import
{
LoginScreen
}
from
'
../screens/loginScreen
'
;
import
ModalScreen
from
'
../screens/ModalScreen
'
;
import
ModalScreen
from
'
../screens/ModalScreen
'
;
import
NotFoundScreen
from
'
../screens/NotFoundScreen
'
;
import
NotFoundScreen
from
'
../screens/NotFoundScreen
'
;
import
TabOneScreen
from
'
../screens/TabOneScreen
'
;
import
TabOneScreen
from
'
../screens/TabOneScreen
'
;
...
@@ -36,10 +37,28 @@ export default function Navigation({ colorScheme }: { colorScheme: ColorSchemeNa
...
@@ -36,10 +37,28 @@ export default function Navigation({ colorScheme }: { colorScheme: ColorSchemeNa
const
Stack
=
createNativeStackNavigator
<
RootStackParamList
>
();
const
Stack
=
createNativeStackNavigator
<
RootStackParamList
>
();
function
RootNavigator
()
{
function
RootNavigator
()
{
const
[
isAuthenticated
,
setIsAutheticated
]
=
React
.
useState
(
false
)
const
onLogin
=
()
=>
{
setIsAutheticated
(
true
)
}
const
onLogout
=
()
=>
{
setIsAutheticated
(
false
)
}
return
(
return
(
<
Stack
.
Navigator
>
<
Stack
.
Navigator
>
<
Stack
.
Screen
name=
"Root"
component=
{
BottomTabNavigator
}
options=
{
{
headerShown
:
false
}
}
/>
{
isAuthenticated
?
<
Stack
.
Screen
name=
"Root"
options=
{
{
headerShown
:
false
}
}
>
{
(
props
)
=>
<
BottomTabNavigator
{
...
props
}
onLogout=
{
onLogout
}
/>
}
</
Stack
.
Screen
>
:
<
Stack
.
Screen
name=
'Login'
>
{
(
props
)
=>
<
LoginScreen
{
...
props
}
onLogin=
{
onLogin
}
/>
}
</
Stack
.
Screen
>
}
<
Stack
.
Screen
name=
"NotFound"
component=
{
NotFoundScreen
}
options=
{
{
title
:
'
Oops!
'
}
}
/>
<
Stack
.
Screen
name=
"NotFound"
component=
{
NotFoundScreen
}
options=
{
{
title
:
'
Oops!
'
}
}
/>
<
Stack
.
Group
screenOptions=
{
{
presentation
:
'
modal
'
}
}
>
<
Stack
.
Group
screenOptions=
{
{
presentation
:
'
modal
'
}
}
>
<
Stack
.
Screen
name=
"Modal"
component=
{
ModalScreen
}
/>
<
Stack
.
Screen
name=
"Modal"
component=
{
ModalScreen
}
/>
</
Stack
.
Group
>
</
Stack
.
Group
>
...
@@ -53,7 +72,7 @@ function RootNavigator() {
...
@@ -53,7 +72,7 @@ function RootNavigator() {
*/
*/
const
BottomTab
=
createBottomTabNavigator
<
RootTabParamList
>
();
const
BottomTab
=
createBottomTabNavigator
<
RootTabParamList
>
();
function
BottomTabNavigator
()
{
function
BottomTabNavigator
(
{
onLogout
}
)
{
const
colorScheme
=
useColorScheme
();
const
colorScheme
=
useColorScheme
();
return
(
return
(
...
@@ -66,11 +85,12 @@ function BottomTabNavigator() {
...
@@ -66,11 +85,12 @@ function BottomTabNavigator() {
name=
"TabOne"
name=
"TabOne"
component=
{
TabOneScreen
}
component=
{
TabOneScreen
}
options=
{
({
navigation
}:
RootTabScreenProps
<
'
TabOne
'
>
)
=>
({
options=
{
({
navigation
}:
RootTabScreenProps
<
'
TabOne
'
>
)
=>
({
title
:
'
Tab One
'
,
title
:
'
Chat
'
,
tabBarIcon
:
({
color
})
=>
<
TabBarIcon
name=
"code"
color=
{
color
}
/>,
tabBarIcon
:
({
color
})
=>
<
TabBarIcon
name=
"code"
color=
{
color
}
/>,
headerRight
:
()
=>
(
headerRight
:
()
=>
(
<
Pressable
<
Pressable
onPress=
{
()
=>
navigation
.
navigate
(
'
Modal
'
)
}
// onPress=
{()
=
>
navigation.navigate('Modal')}
onPress=
{
onLogout
}
style=
{
({
pressed
})
=>
({
style=
{
({
pressed
})
=>
({
opacity
:
pressed
?
0.5
:
1
,
opacity
:
pressed
?
0.5
:
1
,
})
}
>
})
}
>
...
...
MobileApp/package.json
View file @
de86a677
...
@@ -18,14 +18,19 @@
...
@@ -18,14 +18,19 @@
"@react-navigation/bottom-tabs"
:
"^6.0.5"
,
"@react-navigation/bottom-tabs"
:
"^6.0.5"
,
"@react-navigation/native"
:
"^6.0.2"
,
"@react-navigation/native"
:
"^6.0.2"
,
"@react-navigation/native-stack"
:
"^6.1.0"
,
"@react-navigation/native-stack"
:
"^6.1.0"
,
"axios"
:
"^0.27.2"
,
"expo"
:
"~44.0.0"
,
"expo"
:
"~44.0.0"
,
"expo-asset"
:
"~8.4.4"
,
"expo-asset"
:
"~8.4.4"
,
"expo-av"
:
"~10.2.0"
,
"expo-constants"
:
"~13.0.0"
,
"expo-constants"
:
"~13.0.0"
,
"expo-file-system"
:
"~13.1.4"
,
"expo-font"
:
"~10.0.4"
,
"expo-font"
:
"~10.0.4"
,
"expo-linking"
:
"~3.0.0"
,
"expo-linking"
:
"~3.0.0"
,
"expo-media-library"
:
"~14.0.0"
,
"expo-splash-screen"
:
"~0.14.0"
,
"expo-splash-screen"
:
"~0.14.0"
,
"expo-status-bar"
:
"~1.2.0"
,
"expo-status-bar"
:
"~1.2.0"
,
"expo-web-browser"
:
"~10.1.0"
,
"expo-web-browser"
:
"~10.1.0"
,
"jwt-decode"
:
"^3.1.2"
,
"react"
:
"17.0.1"
,
"react"
:
"17.0.1"
,
"react-dom"
:
"17.0.1"
,
"react-dom"
:
"17.0.1"
,
"react-native"
:
"0.64.3"
,
"react-native"
:
"0.64.3"
,
...
@@ -37,8 +42,8 @@
...
@@ -37,8 +42,8 @@
"@babel/core"
:
"^7.12.9"
,
"@babel/core"
:
"^7.12.9"
,
"@types/react"
:
"~17.0.21"
,
"@types/react"
:
"~17.0.21"
,
"@types/react-native"
:
"~0.64.12"
,
"@types/react-native"
:
"~0.64.12"
,
"jest-expo"
:
"~44.0.1"
,
"jest"
:
"^26.6.3"
,
"jest"
:
"^26.6.3"
,
"jest-expo"
:
"~44.0.1"
,
"react-test-renderer"
:
"17.0.1"
,
"react-test-renderer"
:
"17.0.1"
,
"typescript"
:
"~4.3.5"
"typescript"
:
"~4.3.5"
},
},
...
...
MobileApp/screens/TabOneScreen.tsx
View file @
de86a677
import
React
,
{
useState
}
from
'
react
'
import
{
StyleSheet
,
TextInput
}
from
'
react-native
'
;
import
{
StyleSheet
,
TextInput
}
from
'
react-native
'
;
import
{
AudioRecorder
}
from
'
../components/AudioRecorder
'
;
import
EditScreenInfo
from
'
../components/EditScreenInfo
'
;
import
EditScreenInfo
from
'
../components/EditScreenInfo
'
;
import
{
Text
,
View
}
from
'
../components/Themed
'
;
import
{
Text
,
View
}
from
'
../components/Themed
'
;
import
{
RootTabScreenProps
}
from
'
../types
'
;
import
{
RootTabScreenProps
}
from
'
../types
'
;
export
default
function
TabOneScreen
({
navigation
}:
RootTabScreenProps
<
'
TabOne
'
>
)
{
export
default
function
TabOneScreen
({
navigation
}:
RootTabScreenProps
<
'
TabOne
'
>
)
{
const
[
detectedText
,
setDetectedText
]
=
useState
(
""
)
return
(
return
(
<
View
style=
{
styles
.
container
}
>
<
View
style=
{
styles
.
container
}
>
<
Text
style=
{
styles
.
title
}
>
Tab One
</
Text
>
{
/*
<Text style={styles.title}>Tab One</Text>
<
View
style=
{
{
height
:
70
,
width
:
100
,
backgroundColor
:
''
}
}
><
TextInput
style=
{
{
height
:
100
,
width
:
1000
,
}
}
onChange=
{
()
=>
console
.
log
(
'
change
'
)
}
></
TextInput
></
View
>
<View style={{height: 70, width: 100, backgroundColor: ''}}><TextInput style={{
borderColor: 'white', borderWidth: 1, alignSelf:
}} onChange={() => console.log('change')}></TextInput></View>
<View style={styles.separator} lightColor="#000" darkColor="rgba(255,0,255,0.1)" />
<View style={styles.separator} lightColor="#000" darkColor="rgba(255,0,255,0.1)" />
<
EditScreenInfo
path=
"/screens/TabOneScreen.tsx"
/>
<EditScreenInfo path="/screens/TabOneScreen.tsx" /> */
}
<
View
style=
{
{
flex
:
1
,
width
:
'
100%
'
}
}
>
<
View
style=
{
{
display
:
'
flex
'
,
flex
:
0.9
,
backgroundColor
:
'
green
'
}
}
>
<
View
style=
{
{
alignItems
:
'
center
'
,
justifyContent
:
'
center
'
,
height
:
'
100%
'
}
}
><
Text
style=
{
{
fontSize
:
50
,
color
:
'
white
'
}
}
>
{
detectedText
}
</
Text
></
View
>
</
View
>
<
View
style=
{
{
flex
:
0.1
,
backgroundColor
:
'
rgb(10,10,10)
'
}
}
>
<
View
style=
{
{
flexDirection
:
'
row
'
,
display
:
'
flex
'
,
height
:
'
100%
'
}
}
>
<
View
style=
{
{
flex
:
0.8
,
backgroundColor
:
'
rgb(10,10,10)
'
,
height
:
'
100%
'
}
}
></
View
>
<
View
style=
{
{
flex
:
0.2
,
backgroundColor
:
'
rgb(10,10,10)
'
,
height
:
'
100%
'
}
}
><
AudioRecorder
setDetectedText=
{
setDetectedText
}
/></
View
>
</
View
>
</
View
>
</
View
>
</
View
>
</
View
>
);
);
}
}
...
...
MobileApp/screens/TabTwoScreen.tsx
View file @
de86a677
...
@@ -6,9 +6,7 @@ import { Text, View } from '../components/Themed';
...
@@ -6,9 +6,7 @@ import { Text, View } from '../components/Themed';
export
default
function
TabTwoScreen
()
{
export
default
function
TabTwoScreen
()
{
return
(
return
(
<
View
style=
{
styles
.
container
}
>
<
View
style=
{
styles
.
container
}
>
<
Text
style=
{
styles
.
title
}
>
Tab Two
</
Text
>
<
View
style=
{
styles
.
separator
}
lightColor=
"#eee"
darkColor=
"rgba(255,255,255,0.1)"
/>
<
EditScreenInfo
path=
"/screens/TabTwoScreen.tsx"
/>
</
View
>
</
View
>
);
);
}
}
...
...
MobileApp/screens/loginScreen.js
0 → 100644
View file @
de86a677
import
React
from
'
react
'
import
{
StyleSheet
,
TextInput
}
from
'
react-native
'
;
import
EditScreenInfo
from
'
../components/EditScreenInfo
'
;
import
{
Text
,
View
}
from
'
../components/Themed
'
;
import
{
TouchableOpacity
}
from
'
react-native
'
;
const
LoginForm
=
({
onLogin
})
=>
{
var
passwordInput
return
(
<>
<
TextInput
style
=
{
styles
.
input
}
autoCapitalize
=
"
none
"
// onSubmitEditing={() => passwordInput.focus()}
autoCorrect
=
{
false
}
keyboardType
=
'
email-address
'
returnKeyType
=
"
next
"
placeholder
=
'
Email
'
placeholderTextColor
=
'
rgba(225,225,225,0.7)
'
/>
<
TextInput
style
=
{
styles
.
input
}
returnKeyType
=
"
go
"
ref
=
{(
input
)
=>
passwordInput
=
input
}
placeholder
=
'
Password
'
placeholderTextColor
=
'
rgba(225,225,225,0.7)
'
secureTextEntry
/>
<
TouchableOpacity
style
=
{
styles
.
buttonContainer
}
// onPress={onButtonPress}
onPress
=
{
onLogin
}
>
<
Text
style
=
{
styles
.
buttonText
}
>
LOGIN
<
/Text
>
<
/TouchableOpacity
>
<
/
>
// define your styles
)
}
export
const
LoginScreen
=
({
onLogin
})
=>
{
return
(
<
View
style
=
{
styles
.
container
}
>
<
View
style
=
{
styles
.
loginContainer
}
>
{
/* r<Image resizeMode="contain" style={styles.logo} source={require('../../components/images/logo-dark-bg.png')} /> */
}
<
/View
>
<
View
style
=
{
styles
.
formContainer
}
>
<
LoginForm
onLogin
=
{
onLogin
}
/
>
<
/View
>
<
/View
>
);
}
// define your styles
const
styles
=
StyleSheet
.
create
({
container
:
{
flex
:
1
,
backgroundColor
:
'
#2c3e50
'
,
},
loginContainer
:
{
alignItems
:
'
center
'
,
flexGrow
:
1
,
justifyContent
:
'
center
'
},
logo
:
{
position
:
'
absolute
'
,
width
:
300
,
height
:
100
},
container
:
{
padding
:
20
},
input
:
{
height
:
40
,
backgroundColor
:
'
rgba(225,225,225,0.2)
'
,
marginBottom
:
10
,
padding
:
10
,
color
:
'
#fff
'
},
buttonContainer
:
{
backgroundColor
:
'
#2980b6
'
,
paddingVertical
:
15
},
buttonText
:
{
color
:
'
#fff
'
,
textAlign
:
'
center
'
,
fontWeight
:
'
700
'
}
})
\ No newline at end of file
MobileApp/types.tsx
View file @
de86a677
...
@@ -16,6 +16,7 @@ declare global {
...
@@ -16,6 +16,7 @@ declare global {
export
type
RootStackParamList
=
{
export
type
RootStackParamList
=
{
Root
:
NavigatorScreenParams
<
RootTabParamList
>
|
undefined
;
Root
:
NavigatorScreenParams
<
RootTabParamList
>
|
undefined
;
Modal
:
undefined
;
Modal
:
undefined
;
Login
:
undefined
;
NotFound
:
undefined
;
NotFound
:
undefined
;
};
};
...
...
MobileApp/yarn.lock
View file @
de86a677
...
@@ -2151,6 +2151,14 @@ atob@^2.1.2:
...
@@ -2151,6 +2151,14 @@ atob@^2.1.2:
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9"
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
integrity sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==
axios@^0.27.2:
version "0.27.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.27.2.tgz#207658cc8621606e586c85db4b41a750e756d972"
integrity sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==
dependencies:
follow-redirects "^1.14.9"
form-data "^4.0.0"
babel-core@^7.0.0-bridge.0:
babel-core@^7.0.0-bridge.0:
version "7.0.0-bridge.0"
version "7.0.0-bridge.0"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece"
...
@@ -3218,6 +3226,13 @@ expo-asset@~8.4.4, expo-asset@~8.4.6:
...
@@ -3218,6 +3226,13 @@ expo-asset@~8.4.4, expo-asset@~8.4.6:
path-browserify "^1.0.0"
path-browserify "^1.0.0"
url-parse "^1.4.4"
url-parse "^1.4.4"
expo-av@~10.2.0:
version "10.2.1"
resolved "https://registry.yarnpkg.com/expo-av/-/expo-av-10.2.1.tgz#c08bce464d673d0e90c68cac082bfb75a9437f25"
integrity sha512-thrkHVg4HVn8L+jHKVnXYd4TLkJQblFE8QXd3d1hwrYG63gehQT2nK4DM0Frl50EcdV8YN9XjhwHobtK5oMc9A==
dependencies:
"@expo/config-plugins" "^4.0.2"
expo-constants@~13.0.0, expo-constants@~13.0.2:
expo-constants@~13.0.0, expo-constants@~13.0.2:
version "13.0.2"
version "13.0.2"
resolved "https://registry.yarnpkg.com/expo-constants/-/expo-constants-13.0.2.tgz#b489ecd575cc82a9a0b3dfbf2385d45a44300eb1"
resolved "https://registry.yarnpkg.com/expo-constants/-/expo-constants-13.0.2.tgz#b489ecd575cc82a9a0b3dfbf2385d45a44300eb1"
...
@@ -3231,7 +3246,7 @@ expo-error-recovery@~3.0.5:
...
@@ -3231,7 +3246,7 @@ expo-error-recovery@~3.0.5:
resolved "https://registry.yarnpkg.com/expo-error-recovery/-/expo-error-recovery-3.0.5.tgz#1802b733e998606a8fcfb0abe6682c334319ef75"
resolved "https://registry.yarnpkg.com/expo-error-recovery/-/expo-error-recovery-3.0.5.tgz#1802b733e998606a8fcfb0abe6682c334319ef75"
integrity sha512-VM6OOecjt0aPu5/eCdGGJfNjvAZIemaQym0JF/+SA5IlLiPpEfbVCDTO/5yiS8Zb5fKpeABx+GCRmtfnFqvRRw==
integrity sha512-VM6OOecjt0aPu5/eCdGGJfNjvAZIemaQym0JF/+SA5IlLiPpEfbVCDTO/5yiS8Zb5fKpeABx+GCRmtfnFqvRRw==
expo-file-system@~13.1.3
:
expo-file-system@~13.1.3
, expo-file-system@~13.1.4:
version "13.1.4"
version "13.1.4"
resolved "https://registry.yarnpkg.com/expo-file-system/-/expo-file-system-13.1.4.tgz#08fc20d49b2182e1fd195d95c40cf7eddfe7bd91"
resolved "https://registry.yarnpkg.com/expo-file-system/-/expo-file-system-13.1.4.tgz#08fc20d49b2182e1fd195d95c40cf7eddfe7bd91"
integrity sha512-/C2FKCzrdWuEt4m8Pzl9J4MhKgfU0denVLbqoKjidv8DnsLQrscFNlLhXuiooqWwsxB2OWAtGEVnPGJBWVuNEQ==
integrity sha512-/C2FKCzrdWuEt4m8Pzl9J4MhKgfU0denVLbqoKjidv8DnsLQrscFNlLhXuiooqWwsxB2OWAtGEVnPGJBWVuNEQ==
...
@@ -3261,6 +3276,13 @@ expo-linking@~3.0.0:
...
@@ -3261,6 +3276,13 @@ expo-linking@~3.0.0:
qs "^6.9.1"
qs "^6.9.1"
url-parse "^1.4.4"
url-parse "^1.4.4"
expo-media-library@~14.0.0:
version "14.0.1"
resolved "https://registry.yarnpkg.com/expo-media-library/-/expo-media-library-14.0.1.tgz#b1a2ce3699edf6b5f561d32812e608ba064ba43f"
integrity sha512-a7NGFxZvns81y0fRZJsBROXFWKtyEMaodw+x32IPNhKLUAn+X1ggfBS8FbNpUs3bA4ZvhjFQBn59dxPfcHHxEg==
dependencies:
"@expo/config-plugins" "^4.0.2"
expo-modules-autolinking@0.5.5, expo-modules-autolinking@~0.5.1:
expo-modules-autolinking@0.5.5, expo-modules-autolinking@~0.5.1:
version "0.5.5"
version "0.5.5"
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-0.5.5.tgz#6bcc42072dcbdfca79d207b7f549f1fdb54a2b74"
resolved "https://registry.yarnpkg.com/expo-modules-autolinking/-/expo-modules-autolinking-0.5.5.tgz#6bcc42072dcbdfca79d207b7f549f1fdb54a2b74"
...
@@ -3518,6 +3540,11 @@ flow-parser@^0.121.0:
...
@@ -3518,6 +3540,11 @@ flow-parser@^0.121.0:
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.121.0.tgz#9f9898eaec91a9f7c323e9e992d81ab5c58e618f"
resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.121.0.tgz#9f9898eaec91a9f7c323e9e992d81ab5c58e618f"
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
integrity sha512-1gIBiWJNR0tKUNv8gZuk7l9rVX06OuLzY9AoGio7y/JT4V1IZErEMEq2TJS+PFcw/y0RshZ1J/27VfK1UQzYVg==
follow-redirects@^1.14.9:
version "1.15.0"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.0.tgz#06441868281c86d0dda4ad8bdaead2d02dca89d4"
integrity sha512-aExlJShTV4qOUOL7yF1U5tvLCB0xQuudbf6toyYA0E/acBNw71mvjFTnLaRp50aQaYocMR0a/RMMBIHeZnGyjQ==
fontfaceobserver@^2.1.0:
fontfaceobserver@^2.1.0:
version "2.1.0"
version "2.1.0"
resolved "https://registry.yarnpkg.com/fontfaceobserver/-/fontfaceobserver-2.1.0.tgz#e2705d293e2c585a6531c2a722905657317a2991"
resolved "https://registry.yarnpkg.com/fontfaceobserver/-/fontfaceobserver-2.1.0.tgz#e2705d293e2c585a6531c2a722905657317a2991"
...
@@ -3537,6 +3564,15 @@ form-data@^3.0.0:
...
@@ -3537,6 +3564,15 @@ form-data@^3.0.0:
combined-stream "^1.0.8"
combined-stream "^1.0.8"
mime-types "^2.1.12"
mime-types "^2.1.12"
form-data@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/form-data/-/form-data-4.0.0.tgz#93919daeaf361ee529584b9b31664dc12c9fa452"
integrity sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==
dependencies:
asynckit "^0.4.0"
combined-stream "^1.0.8"
mime-types "^2.1.12"
fragment-cache@^0.2.1:
fragment-cache@^0.2.1:
version "0.2.1"
version "0.2.1"
resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19"
resolved "https://registry.yarnpkg.com/fragment-cache/-/fragment-cache-0.2.1.tgz#4290fad27f13e89be7f33799c6bc5a0abfff0d19"
...
@@ -4784,6 +4820,11 @@ jsonify@~0.0.0:
...
@@ -4784,6 +4820,11 @@ jsonify@~0.0.0:
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
resolved "https://registry.yarnpkg.com/jsonify/-/jsonify-0.0.0.tgz#2c74b6ee41d93ca51b7b5aaee8f503631d252a73"
integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=
integrity sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=
jwt-decode@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/jwt-decode/-/jwt-decode-3.1.2.tgz#3fb319f3675a2df0c2895c8f5e9fa4b67b04ed59"
integrity sha512-UfpWE/VZn0iP50d8cz9NrZLM9lSWhcJ+0Gt/nm4by88UL+J1SiKN8/5dkjMmbEzwL2CAe+67GsegCbIKtbp75A==
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
kind-of@^3.0.2, kind-of@^3.0.3, kind-of@^3.2.0:
version "3.2.2"
version "3.2.2"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.2.2.tgz#31ea21a734bab9bbb0f32466d893aea51e4a3c64"
...
...
README.md
View file @
de86a677
backend/.gitignore
View file @
de86a677
backend/backend/asgi.py
View file @
de86a677
backend/backend/cms/admin.py
View file @
de86a677
backend/backend/cms/apps.py
View file @
de86a677
backend/backend/cms/migrations/0001_initial.py
View file @
de86a677
backend/backend/cms/model/predict.py
View file @
de86a677
...
@@ -13,7 +13,7 @@ from sklearn.model_selection import train_test_split
...
@@ -13,7 +13,7 @@ from sklearn.model_selection import train_test_split
from
sklearn.preprocessing
import
LabelEncoder
from
sklearn.preprocessing
import
LabelEncoder
def
predict
(
):
def
predict
(
samples
):
model
=
load_model
(
r'./best_model_final.hdf5'
)
model
=
load_model
(
r'./best_model_final.hdf5'
)
f1
=
open
(
'all_label.txt'
,
'rb'
)
f1
=
open
(
'all_label.txt'
,
'rb'
)
...
@@ -38,9 +38,14 @@ def predict():
...
@@ -38,9 +38,14 @@ def predict():
return
classes
[
index
]
return
classes
[
index
]
index
=
random
.
randint
(
0
,
len
(
x_val
)
-
1
)
# index=random.randint(0,len(x_val)-1)
samples
=
x_val
[
index
]
.
ravel
()
# samples=x_val[index].ravel()
print
(
"Audio:"
,
classes
[
np
.
argmax
(
y_val
[
index
])])
print
(
samples
)
# print("Audio:",classes[np.argmax(y_val[index])])
ipd
.
Audio
(
samples
,
rate
=
8000
)
ipd
.
Audio
(
samples
,
rate
=
8000
)
print
(
"Text:"
,
predictSamples
(
samples
))
result
=
predictSamples
(
samples
)
\ No newline at end of file
print
(
"Text:"
,
result
)
return
result
\ No newline at end of file
backend/backend/cms/model/train.py
View file @
de86a677
backend/backend/cms/models.py
View file @
de86a677
backend/backend/cms/serializers.py
View file @
de86a677
backend/backend/cms/tests.py
View file @
de86a677
backend/backend/cms/views.py
View file @
de86a677
...
@@ -6,6 +6,15 @@ from backend.cms.serializers import MlModelSerializer
...
@@ -6,6 +6,15 @@ from backend.cms.serializers import MlModelSerializer
from
backend.cms.serializers
import
UserSerializer
,
GroupSerializer
from
backend.cms.serializers
import
UserSerializer
,
GroupSerializer
from
rest_framework.decorators
import
action
from
rest_framework.decorators
import
action
from
rest_framework.response
import
Response
from
rest_framework.response
import
Response
import
mimetypes
import
os
from
rest_framework.parsers
import
MultiPartParser
from
io
import
BytesIO
import
librosa
from
django.core.files.storage
import
FileSystemStorage
from
.models
import
MlModel
from
.models
import
MlModel
...
@@ -14,6 +23,10 @@ from .model.train import train
...
@@ -14,6 +23,10 @@ from .model.train import train
from
.model.predict
import
predict
from
.model.predict
import
predict
from
pydub
import
AudioSegment
import
numpy
as
np
class
UserViewSet
(
viewsets
.
ModelViewSet
):
class
UserViewSet
(
viewsets
.
ModelViewSet
):
"""
"""
API endpoint that allows users to be viewed or edited.
API endpoint that allows users to be viewed or edited.
...
@@ -45,7 +58,8 @@ class MlModelViewSet(viewsets.ViewSet):
...
@@ -45,7 +58,8 @@ class MlModelViewSet(viewsets.ViewSet):
queryset
=
MlModel
.
objects
.
all
()
queryset
=
MlModel
.
objects
.
all
()
serializer_class
=
MlModelSerializer
serializer_class
=
MlModelSerializer
permission_classes
=
[
permissions
.
IsAuthenticated
]
permission_classes
=
[
permissions
.
AllowAny
]
parser_classes
=
[
MultiPartParser
]
@
action
(
detail
=
False
)
@
action
(
detail
=
False
)
def
train
(
*
args
,
**
kwargs
):
def
train
(
*
args
,
**
kwargs
):
...
@@ -55,12 +69,70 @@ class MlModelViewSet(viewsets.ViewSet):
...
@@ -55,12 +69,70 @@ class MlModelViewSet(viewsets.ViewSet):
return
Response
({
'success'
:
True
})
return
Response
({
'success'
:
True
})
@
action
(
detail
=
False
)
@
action
(
detail
=
False
,
methods
=
[
"POST"
])
def
predict
(
*
args
,
**
kwargs
):
def
detect
(
self
,
request
,
*
args
,
**
kwargs
):
print
(
'Function ran'
)
print
(
'Function ran'
)
results
=
predict
()
print
(
request
.
headers
)
bytesio_object
=
list
(
request
.
data
.
dict
()
.
values
())[
0
]
.
file
print
(
bytesio_object
)
with
open
(
"output.m4a"
,
"wb"
)
as
f
:
f
.
write
(
bytesio_object
.
getbuffer
())
# convert wav to mp3
audSeg
=
AudioSegment
.
from_file
(
"output.m4a"
)
audSeg
.
export
(
'output.wav'
,
format
=
"wav"
)
samples
,
sample_rate
=
librosa
.
load
(
'output.wav'
,
sr
=
16000
)
samples
=
librosa
.
resample
(
samples
,
sample_rate
,
8000
)
print
(
'---------------------------------------------------------'
)
if
(
samples
.
shape
[
0
]
>
8000
):
print
(
'grateer -------------------------------------'
)
samples
=
samples
[
-
8000
:]
print
(
samples
.
shape
)
else
:
len
=
8000
-
samples
.
shape
[
0
]
new_arr
=
np
.
zeroes
(
len
,
)
samples
=
np
.
concatenate
((
samples
,
new_arr
))
print
(
samples
.
shape
)
# audio_file = request.data
# # Using File storage to save file for future converting
# fs = FileSystemStorage()
# file_name = fs.save(audio_file.name, audio_file)
# audio_file_url = fs.url(file_name)
# # Preparing paths for convertion
# upstream = os.path.dirname(os.path.dirname(os.path.dirname(
# os.path.abspath(__file__))))
# path = os.path.join(upstream, 'media', audio_file.name)
# mp3_filename = '.'.join([audio_file.name.split('.')[0], 'mp3'])
# new_path = os.path.join(
# upstream, 'media', mp3_filename)
# # Converting to mp3 here
# wma_version = AudioSegment.from_file(path, "wav")
# wma_version.export(new_path, format="mp3")
# user_id = self.request.user.id
# # I was trying to create a Track instance, the mp3 get's saved but it is not being saved using location specified in models.
# track = Track.objects.create(user_id=user_id)
# track.file.name = mp3_filename
# track.save()
results
=
predict
(
samples
)
print
(
results
)
print
(
results
)
return
Response
({
'success'
:
True
})
return
Response
({
'success'
:
True
,
'result'
:
results
})
...
...
backend/backend/settings.py
View file @
de86a677
...
@@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
...
@@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/4.0/ref/settings/
from
pathlib
import
Path
from
pathlib
import
Path
import
datetime
# Build paths inside the project like this: BASE_DIR / 'subdir'.
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR
=
Path
(
__file__
)
.
resolve
()
.
parent
.
parent
BASE_DIR
=
Path
(
__file__
)
.
resolve
()
.
parent
.
parent
...
@@ -25,7 +27,7 @@ SECRET_KEY = 'django-insecure-54-4$#$7yzk9*+myixyk2fu(-u0sg(wtf8a$ets11yeqs5w0ly
...
@@ -25,7 +27,7 @@ SECRET_KEY = 'django-insecure-54-4$#$7yzk9*+myixyk2fu(-u0sg(wtf8a$ets11yeqs5w0ly
# SECURITY WARNING: don't run with debug turned on in production!
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG
=
True
DEBUG
=
True
ALLOWED_HOSTS
=
[
]
ALLOWED_HOSTS
=
[
'*'
]
# Application definition
# Application definition
...
@@ -126,5 +128,31 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
...
@@ -126,5 +128,31 @@ DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
REST_FRAMEWORK
=
{
REST_FRAMEWORK
=
{
'DEFAULT_PAGINATION_CLASS'
:
'rest_framework.pagination.PageNumberPagination'
,
'DEFAULT_PAGINATION_CLASS'
:
'rest_framework.pagination.PageNumberPagination'
,
'PAGE_SIZE'
:
10
'PAGE_SIZE'
:
10
,
'DEFAULT_AUTHENTICATION_CLASSES'
:
(
'rest_framework_simplejwt.authentication.JWTAuthentication'
,
'rest_framework.authentication.SessionAuthentication'
,
)
}
SIMPLE_JWT
=
{
'ACCESS_TOKEN_LIFETIME'
:
datetime
.
timedelta
(
minutes
=
14
*
24
*
60
),
'REFRESH_TOKEN_LIFETIME'
:
datetime
.
timedelta
(
days
=
30
),
'ROTATE_REFRESH_TOKENS'
:
True
,
'BLACKLIST_AFTER_ROTATION'
:
True
,
'ALGORITHM'
:
'HS256'
,
'SIGNING_KEY'
:
SECRET_KEY
,
'VERIFYING_KEY'
:
None
,
'AUTH_HEADER_TYPES'
:
(
'Bearer'
,),
'USER_ID_FIELD'
:
'id'
,
'USER_ID_CLAIM'
:
'user_id'
,
'AUTH_TOKEN_CLASSES'
:
(
'rest_framework_simplejwt.tokens.AccessToken'
,),
'TOKEN_TYPE_CLAIM'
:
'token_type'
,
'SLIDING_TOKEN_REFRESH_EXP_CLAIM'
:
'refresh_exp'
,
'SLIDING_TOKEN_LIFETIME'
:
datetime
.
timedelta
(
minutes
=
5
),
'SLIDING_TOKEN_REFRESH_LIFETIME'
:
datetime
.
timedelta
(
days
=
1
),
}
}
\ No newline at end of file
backend/backend/urls.py
View file @
de86a677
from
django.urls
import
include
,
path
from
django.urls
import
include
,
path
,
re_path
from
rest_framework
import
routers
from
rest_framework
import
routers
from
backend.cms
import
views
from
backend.cms
import
views
from
rest_framework_simplejwt.views
import
TokenObtainPairView
,
TokenRefreshView
router
=
routers
.
DefaultRouter
()
router
=
routers
.
DefaultRouter
()
router
.
register
(
r'users'
,
views
.
UserViewSet
)
router
.
register
(
r'users'
,
views
.
UserViewSet
)
...
@@ -11,5 +12,7 @@ router.register(r'mlmodels', views.MlModelViewSet)
...
@@ -11,5 +12,7 @@ router.register(r'mlmodels', views.MlModelViewSet)
# Additionally, we include login URLs for the browsable API.
# Additionally, we include login URLs for the browsable API.
urlpatterns
=
[
urlpatterns
=
[
path
(
''
,
include
(
router
.
urls
)),
path
(
''
,
include
(
router
.
urls
)),
path
(
'api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
))
path
(
'api-auth/'
,
include
(
'rest_framework.urls'
,
namespace
=
'rest_framework'
)),
re_path
(
r'^api/auth/token/obtain/$'
,
TokenObtainPairView
.
as_view
()),
re_path
(
r'^api/auth/token/refresh/$'
,
TokenRefreshView
.
as_view
())
]
]
\ No newline at end of file
backend/backend/wsgi.py
View file @
de86a677
backend/db_old.sqlite3
0 → 100644
View file @
de86a677
File added
backend/manage.py
View file @
de86a677
requirements.txt
View file @
de86a677
B
absl-py
==1.0.0
B
absl-py
==1.0.0
...
...
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