Commit 0a888d5e authored by ple98's avatar ple98

minor changes

parent 51c952f1
......@@ -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("sensitive_score")
sensitive_score = whitelist_entry.get("sensitivity_score")
print(sensitive_score)
if sensitive_score == 1:
return "safe"
......
......@@ -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}."
......
......@@ -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.17.111:5000/check_word', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
......
......@@ -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.17.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: 20,
paddingTop: 90,
},
card: {
width: '30%',
......
......@@ -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.17.111:5000/api/similar-words?word=cat');
const data = await response.json();
//console.log(data)
return data.similar_words;
......
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