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
0a888d5e
Commit
0a888d5e
authored
May 16, 2023
by
ple98
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
51c952f1
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
9 deletions
+18
-9
App/Backend/__pycache__/content_filtration.cpython-311.pyc
App/Backend/__pycache__/content_filtration.cpython-311.pyc
+0
-0
App/Backend/__pycache__/word_generation.cpython-311.pyc
App/Backend/__pycache__/word_generation.cpython-311.pyc
+0
-0
App/Backend/content_filtration.py
App/Backend/content_filtration.py
+2
-1
App/Backend/word_generation.py
App/Backend/word_generation.py
+5
-4
App/Frontend/screens/ContentFiltrationScreen.js
App/Frontend/screens/ContentFiltrationScreen.js
+1
-1
App/Frontend/screens/FlipCardGameScreen.js
App/Frontend/screens/FlipCardGameScreen.js
+9
-2
App/Frontend/screens/WordGenerationScreen.js
App/Frontend/screens/WordGenerationScreen.js
+1
-1
No files found.
App/Backend/__pycache__/content_filtration.cpython-311.pyc
View file @
0a888d5e
No preview for this file type
App/Backend/__pycache__/word_generation.cpython-311.pyc
View file @
0a888d5e
No preview for this file type
App/Backend/content_filtration.py
View file @
0a888d5e
...
...
@@ -8,6 +8,7 @@ def check_word_safety(word):
whitelist_col
=
db
[
'whitelist'
]
moderate_col
=
db
[
'moderate'
]
word
=
word
.
lower
()
# Check if the word exists in the blacklist
if
blacklist_col
.
find_one
({
"word"
:
word
}):
return
"unsafe"
...
...
@@ -15,7 +16,7 @@ def check_word_safety(word):
# Check if the word exists in the whitelist
whitelist_entry
=
whitelist_col
.
find_one
({
"word"
:
word
})
if
whitelist_entry
:
sensitive_score
=
whitelist_entry
.
get
(
"sensitiv
e
_score"
)
sensitive_score
=
whitelist_entry
.
get
(
"sensitiv
ity
_score"
)
print
(
sensitive_score
)
if
sensitive_score
==
1
:
return
"safe"
...
...
App/Backend/word_generation.py
View file @
0a888d5e
...
...
@@ -14,13 +14,14 @@ def get_similar_words(input_word, top_k=3):
db_0
=
client
[
'vocabulary'
]
collection_0
=
db_0
[
'object_expore'
]
cursor
=
collection_0
.
find
()
# Print out each document
for
document
in
cursor
:
print
(
document
)
random_word
=
collection_0
.
aggregate
([{
'$sample'
:
{
'size'
:
1
}}])
.
next
()[
'object'
]
input_word
=
random_word
.
strip
()
print
(
input_word
)
print
(
'---------------------------------------------------------'
)
print
(
''
)
print
(
"Input word = "
+
input_word
)
# Create a masked sentence with the input word
masked_sentence
=
f
"The {input_word} is related to the {tokenizer.mask_token}."
...
...
App/Frontend/screens/ContentFiltrationScreen.js
View file @
0a888d5e
...
...
@@ -7,7 +7,7 @@ export default function ContentFiltration() {
const
checkWord
=
async
()
=>
{
try
{
const
response
=
await
fetch
(
'
http://192.168.1
.83
:5000/check_word
'
,
{
const
response
=
await
fetch
(
'
http://192.168.1
7.111
:5000/check_word
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
,
...
...
App/Frontend/screens/FlipCardGameScreen.js
View file @
0a888d5e
...
...
@@ -112,7 +112,7 @@ export default function FlipCardGame() {
const
fetchImagesData
=
async
()
=>
{
try
{
const
response
=
await
fetch
(
'
http://192.168.1
.86
:5000/api/images_data
'
);
const
response
=
await
fetch
(
'
http://192.168.1
7.111
:5000/api/images_data
'
);
const
data
=
await
response
.
json
();
//console.log(data);
...
...
@@ -138,7 +138,9 @@ export default function FlipCardGame() {
};
return
(
<
View
style
=
{
styles
.
container
}
>
<
Image
source
=
{
require
(
'
./assets/home/home_bg.png
'
)}
style
=
{
styles
.
backgroundImage
}
resizeMode
=
"
cover
"
/>
{
mainImage
&&
<
Image
source
=
{{
uri
:
mainImage
.
image_link
}}
style
=
{
styles
.
mainImage
}
/>
}
<
View
style
=
{
styles
.
cardsContainer
}
>
{
imagesData
...
...
@@ -174,6 +176,11 @@ const styles = StyleSheet.create({
alignItems
:
'
center
'
,
backgroundColor
:
'
#fff
'
,
},
backgroundImage
:
{
height
:
'
100%
'
,
width
:
'
100%
'
,
position
:
'
absolute
'
,
},
mainImage
:
{
width
:
'
80%
'
,
height
:
'
35%
'
,
...
...
@@ -184,7 +191,7 @@ const styles = StyleSheet.create({
justifyContent
:
'
space-around
'
,
alignItems
:
'
center
'
,
// Add this line
width
:
'
100%
'
,
paddingTop
:
2
0
,
paddingTop
:
9
0
,
},
card
:
{
width
:
'
30%
'
,
...
...
App/Frontend/screens/WordGenerationScreen.js
View file @
0a888d5e
...
...
@@ -20,7 +20,7 @@ const screenHeight = Dimensions.get("window").height;
const
fetchCards
=
async
()
=>
{
try
{
const
response
=
await
fetch
(
'
http://192.168.1
.86
:5000/api/similar-words?word=cat
'
);
const
response
=
await
fetch
(
'
http://192.168.1
7.111
:5000/api/similar-words?word=cat
'
);
const
data
=
await
response
.
json
();
//console.log(data)
return
data
.
similar_words
;
...
...
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