Spaces:
Sleeping
Sleeping
Commit
·
65972e1
1
Parent(s):
c6b5511
error handling and color changes
Browse files- DjangoWeb/ModelLoader/colgen1.py +3 -2
- DjangoWeb/main/static/main/index.css +11 -3
- DjangoWeb/main/static/main/index.js +1 -1
- README.md +2 -0
DjangoWeb/ModelLoader/colgen1.py
CHANGED
|
@@ -29,14 +29,15 @@ class Colgen1(ModelBaseClass):
|
|
| 29 |
|
| 30 |
return np.r_[padding,one_hot_vectors] if len(padding)>0 else one_hot_vectors
|
| 31 |
|
| 32 |
-
def preprocess(self,names):
|
| 33 |
""" names: [name,name,name,...] """
|
| 34 |
|
| 35 |
max_num_tokens=0
|
| 36 |
one_hots_list = []
|
| 37 |
|
| 38 |
for name in names:
|
| 39 |
-
name = name.lower()
|
|
|
|
| 40 |
tokens = self.tokenize(name)
|
| 41 |
one_hot_vectors = self.one_hot_encode(tokens,len(self.TOKENS))
|
| 42 |
if len(tokens)>max_num_tokens: max_num_tokens=len(tokens)
|
|
|
|
| 29 |
|
| 30 |
return np.r_[padding,one_hot_vectors] if len(padding)>0 else one_hot_vectors
|
| 31 |
|
| 32 |
+
def preprocess(self,names:list[str]):
|
| 33 |
""" names: [name,name,name,...] """
|
| 34 |
|
| 35 |
max_num_tokens=0
|
| 36 |
one_hots_list = []
|
| 37 |
|
| 38 |
for name in names:
|
| 39 |
+
name = name.lower() # convert to lowercase
|
| 40 |
+
name = "".join([char if char.isalnum() else " " for char in name]) # remove special characters
|
| 41 |
tokens = self.tokenize(name)
|
| 42 |
one_hot_vectors = self.one_hot_encode(tokens,len(self.TOKENS))
|
| 43 |
if len(tokens)>max_num_tokens: max_num_tokens=len(tokens)
|
DjangoWeb/main/static/main/index.css
CHANGED
|
@@ -7,12 +7,17 @@
|
|
| 7 |
html,body{
|
| 8 |
min-height:100%;
|
| 9 |
width:100%;
|
| 10 |
-
background: linear-gradient(45deg ,#333399,#a9ff00);
|
| 11 |
}
|
| 12 |
body{
|
| 13 |
position: absolute;
|
| 14 |
top:0;
|
| 15 |
left:0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
}
|
| 17 |
|
| 18 |
#toast_container{
|
|
@@ -47,11 +52,12 @@ body{
|
|
| 47 |
margin-inline: 20px;
|
| 48 |
background-color: #a9ff00;
|
| 49 |
padding:0.5rem;
|
|
|
|
| 50 |
border-radius: 50px;
|
| 51 |
}
|
| 52 |
|
| 53 |
#main_container{
|
| 54 |
-
background-color: #
|
| 55 |
box-shadow: 1px 1px 20px -10px #000;
|
| 56 |
/* height:100%; */
|
| 57 |
margin: 1.2rem;
|
|
@@ -66,6 +72,7 @@ h2{
|
|
| 66 |
width: fit-content;
|
| 67 |
margin-inline: auto ;
|
| 68 |
font-size:2rem;
|
|
|
|
| 69 |
}
|
| 70 |
|
| 71 |
#search_section{
|
|
@@ -76,10 +83,11 @@ h2{
|
|
| 76 |
#search_input{
|
| 77 |
outline:none;
|
| 78 |
border:none;
|
| 79 |
-
border-bottom: 2px solid #
|
| 80 |
font-size:inherit;
|
| 81 |
background-color: transparent;
|
| 82 |
padding:0.3rem;
|
|
|
|
| 83 |
}
|
| 84 |
|
| 85 |
input[type='button']{
|
|
|
|
| 7 |
html,body{
|
| 8 |
min-height:100%;
|
| 9 |
width:100%;
|
|
|
|
| 10 |
}
|
| 11 |
body{
|
| 12 |
position: absolute;
|
| 13 |
top:0;
|
| 14 |
left:0;
|
| 15 |
+
/* background: linear-gradient(45deg ,#333399,#a9ff00); */
|
| 16 |
+
/* background: linear-gradient(45deg, #ff7e00, #000000, #3300ff); */
|
| 17 |
+
/* background: linear-gradient(0deg,#180077,#1c1c1c,#a9006b); */
|
| 18 |
+
background: linear-gradient(to right, #616161, #0e0101);
|
| 19 |
+
background-size: 200% 200%;
|
| 20 |
+
|
| 21 |
}
|
| 22 |
|
| 23 |
#toast_container{
|
|
|
|
| 52 |
margin-inline: 20px;
|
| 53 |
background-color: #a9ff00;
|
| 54 |
padding:0.5rem;
|
| 55 |
+
aspect-ratio: 1;
|
| 56 |
border-radius: 50px;
|
| 57 |
}
|
| 58 |
|
| 59 |
#main_container{
|
| 60 |
+
background-color: #ffffff1a;
|
| 61 |
box-shadow: 1px 1px 20px -10px #000;
|
| 62 |
/* height:100%; */
|
| 63 |
margin: 1.2rem;
|
|
|
|
| 72 |
width: fit-content;
|
| 73 |
margin-inline: auto ;
|
| 74 |
font-size:2rem;
|
| 75 |
+
color:#fff;
|
| 76 |
}
|
| 77 |
|
| 78 |
#search_section{
|
|
|
|
| 83 |
#search_input{
|
| 84 |
outline:none;
|
| 85 |
border:none;
|
| 86 |
+
border-bottom: 2px solid #fff;
|
| 87 |
font-size:inherit;
|
| 88 |
background-color: transparent;
|
| 89 |
padding:0.3rem;
|
| 90 |
+
color: #fff;
|
| 91 |
}
|
| 92 |
|
| 93 |
input[type='button']{
|
DjangoWeb/main/static/main/index.js
CHANGED
|
@@ -54,7 +54,7 @@ function generateColor(){
|
|
| 54 |
body:JSON.stringify(data),
|
| 55 |
}).then(response=>response.json()).then((res)=>{
|
| 56 |
// create card for it
|
| 57 |
-
createColorCard(
|
| 58 |
})
|
| 59 |
}
|
| 60 |
|
|
|
|
| 54 |
body:JSON.stringify(data),
|
| 55 |
}).then(response=>response.json()).then((res)=>{
|
| 56 |
// create card for it
|
| 57 |
+
createColorCard(res['color_names'][0],res['colors'][0]);
|
| 58 |
})
|
| 59 |
}
|
| 60 |
|
README.md
CHANGED
|
@@ -22,6 +22,7 @@ An RNN based model which is used to generate color from text.
|
|
| 22 |
|
| 23 |
- [X] Make a simple Model (**colgen-1**)
|
| 24 |
- Make it based on character level tokenization
|
|
|
|
| 25 |
- [ ] Model with word-embedding (**colgen-2**)
|
| 26 |
- Make it based on word level tokenization
|
| 27 |
- don't use precalculated word embeddings
|
|
@@ -32,6 +33,7 @@ An RNN based model which is used to generate color from text.
|
|
| 32 |
|
| 33 |
- [X] Basic UI
|
| 34 |
- [X] Generate Color Functionality
|
|
|
|
| 35 |
- [ ] Save old color which are liked
|
| 36 |
- [ ] Add search functionality
|
| 37 |
- [ ] Add API endpoints
|
|
|
|
| 22 |
|
| 23 |
- [X] Make a simple Model (**colgen-1**)
|
| 24 |
- Make it based on character level tokenization
|
| 25 |
+
- It ignores special characters and replace them with a " "
|
| 26 |
- [ ] Model with word-embedding (**colgen-2**)
|
| 27 |
- Make it based on word level tokenization
|
| 28 |
- don't use precalculated word embeddings
|
|
|
|
| 33 |
|
| 34 |
- [X] Basic UI
|
| 35 |
- [X] Generate Color Functionality
|
| 36 |
+
- [X] Add Notifications
|
| 37 |
- [ ] Save old color which are liked
|
| 38 |
- [ ] Add search functionality
|
| 39 |
- [ ] Add API endpoints
|