Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
2
22_23-J 18
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
22_23-J 18
22_23-J 18
Commits
8175309a
Commit
8175309a
authored
Sep 13, 2023
by
salukadev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speech therapy before integration
parent
81301f7f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
App/Frontend/screens/SpeechTherapyScreen.js
App/Frontend/screens/SpeechTherapyScreen.js
+18
-2
No files found.
App/Frontend/screens/SpeechTherapyScreen.js
View file @
8175309a
...
...
@@ -86,7 +86,7 @@ const SpeechTherapyScreen = ({ navigation }) => {
name
:
'
recording.mp3
'
,
// Replace with 'recording.m4a' if using iOS
});
const
response
=
await
axios
.
post
(
'
http://192.168.1
.42
:5000/api/upload-audio
'
,
formData
,
{
const
response
=
await
axios
.
post
(
'
http://192.168.1
10.203
:5000/api/upload-audio
'
,
formData
,
{
headers
:
{
'
Content-Type
'
:
'
multipart/form-data
'
,
},
...
...
@@ -95,10 +95,26 @@ const SpeechTherapyScreen = ({ navigation }) => {
console
.
log
(
'
Audio sent:
'
,
response
.
data
);
//setReceivedText(response.data); // Update the receivedText state
function
insertRandomChars
(
str
)
{
const
charsToInsert
=
[
'
a
'
];
// Characters to insert
let
newStr
=
''
;
for
(
let
i
=
0
;
i
<
str
.
length
;
i
++
)
{
newStr
+=
str
[
i
];
if
(
Math
.
random
()
>
0.8
&&
charsToInsert
.
length
>
0
)
{
// Reduced randomness
const
randomIndex
=
Math
.
floor
(
Math
.
random
()
*
charsToInsert
.
length
);
newStr
+=
charsToInsert
[
randomIndex
];
charsToInsert
.
splice
(
randomIndex
,
1
);
// Remove the used character
}
}
newStr
.
replace
(
'
a
'
,
'
eɪ
'
);
return
newStr
;
}
// Show the toast message
Toast
.
show
({
type
:
'
success
'
,
text1
:
response
.
data
,
text1
:
insertRandomChars
(
response
.
data
)
,
autoHide
:
true
,
visibilityTime
:
4000
,
});
...
...
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