Naandhu commited on
Commit
d705756
·
1 Parent(s): b06fb83

add gitignore

Browse files
Files changed (3) hide show
  1. config.json +2 -2
  2. gitignore +2 -0
  3. utils.py +2 -2
config.json CHANGED
@@ -1,5 +1,5 @@
1
  {
2
- "postprocess_function": "\ndef post_process_code(output):\n import torch\n classes = ['ACCOUNTANT', 'ADVOCATE', 'AGRICULTURE', 'APPAREL', 'ARTS', 'AUTOMOBILE', 'AVIATION', 'BANKING', 'BPO', 'BUSINESS-DEVELOPMENT', 'CHEF', 'CONSTRUCTION', 'CONSULTANT', 'DESIGNER', 'DIGITAL-MEDIA', 'ENGINEERING', 'FINANCE', 'FITNESS', 'HEALTHCARE', 'HR', 'INFORMATION-TECHNOLOGY', 'PUBLIC-RELATIONS', 'SALES', 'TEACHER']\n try:\n logits = output.logits\n sigmoid = torch.nn.Sigmoid()\n probs = sigmoid(logits.squeeze().cpu())\n temp = probs.sort()\n return classes[temp[-1][-1].item()]\n except:\n print(\"Some Error occured\")\n",
3
- "preprocess_function": "\ndef preprocess_code(text):\n import re\n import string\n import spacy\n\n try:\n\n # Checking if it the string\n text = str(text)\n\n # remove html\n text = re.sub(r\"<.*?>\",\"\", text)\n \n # Remove URL\n url_pattern = r\"https?://\\S+|www\\.\\S+|\\S+\\.\\S{2,\"\n text = re.sub(url_pattern,\"\", text)\n\n # Remove Punctuation\n translator = str.maketrans(\"\",\"\", string.punctuation)\n text.translate(translator)\n\n # Lower case\n text.lower().strip()\n\n # Remove Unicodes - only applicable for english language. Because other language letters represented as unicodes.\n unicode_pattern = str.maketrans(\"\",\"\",\"\\xa0\")\n text.translate(unicode_pattern)\n\n # Remove Escape sequences (\\n, \\t, \\r)\n text = re.sub(r\"\\[nt\\r]\",\" \",text)\n\n # Remove Stop words using spacy\n\n spacy.prefer_gpu() # using GPU if available. may reduce the run time.\n nlp = spacy.load(\"en_core_web_sm\")\n doc = nlp(text)\n text = \" \".join([token.text for token in doc if not token.is_stop])\n\n # Remove irrelevant white spaces\n text = re.sub(r\"\\s+\",\" \",text)\n except:\n print(f\"error occured\")\n \n return text\n",
4
  "transformers_version": "4.47.0"
5
  }
 
1
  {
2
+ "postprocess_function": "\ndef post_process(output):\n import torch\n classes = ['ACCOUNTANT', 'ADVOCATE', 'AGRICULTURE', 'APPAREL', 'ARTS', 'AUTOMOBILE', 'AVIATION', 'BANKING', 'BPO', 'BUSINESS-DEVELOPMENT', 'CHEF', 'CONSTRUCTION', 'CONSULTANT', 'DESIGNER', 'DIGITAL-MEDIA', 'ENGINEERING', 'FINANCE', 'FITNESS', 'HEALTHCARE', 'HR', 'INFORMATION-TECHNOLOGY', 'PUBLIC-RELATIONS', 'SALES', 'TEACHER']\n try:\n logits = output.logits\n sigmoid = torch.nn.Sigmoid()\n probs = sigmoid(logits.squeeze().cpu())\n temp = probs.sort()\n return classes[temp[-1][-1].item()]\n except:\n print(\"Some Error occured\")\n",
3
+ "preprocess_function": "\ndef preprocess(text):\n import re\n import string\n import spacy\n\n try:\n\n # Checking if it the string\n text = str(text)\n\n # remove html\n text = re.sub(r\"<.*?>\",\"\", text)\n \n # Remove URL\n url_pattern = r\"https?://\\S+|www\\.\\S+|\\S+\\.\\S{2,\"\n text = re.sub(url_pattern,\"\", text)\n\n # Remove Punctuation\n translator = str.maketrans(\"\",\"\", string.punctuation)\n text.translate(translator)\n\n # Lower case\n text.lower().strip()\n\n # Remove Unicodes - only applicable for english language. Because other language letters represented as unicodes.\n unicode_pattern = str.maketrans(\"\",\"\",\"\\xa0\")\n text.translate(unicode_pattern)\n\n # Remove Escape sequences (\\n, \\t, \\r)\n text = re.sub(r\"\\[nt\\r]\",\" \",text)\n\n # Remove Stop words using spacy\n\n spacy.prefer_gpu() # using GPU if available. may reduce the run time.\n nlp = spacy.load(\"en_core_web_sm\")\n doc = nlp(text)\n text = \" \".join([token.text for token in doc if not token.is_stop])\n\n # Remove irrelevant white spaces\n text = re.sub(r\"\\s+\",\" \",text)\n except:\n print(f\"error occured\")\n \n return text\n",
4
  "transformers_version": "4.47.0"
5
  }
gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ utils.py
2
+
utils.py CHANGED
@@ -1,7 +1,7 @@
1
 
2
  # Preprocess functions
3
  preprocess_code = """
4
- def preprocess_code(text):
5
  import re
6
  import string
7
  import spacy
@@ -49,7 +49,7 @@ def preprocess_code(text):
49
 
50
 
51
  postprocess_code = """
52
- def post_process_code(output):
53
  import torch
54
  classes = ['ACCOUNTANT', 'ADVOCATE', 'AGRICULTURE', 'APPAREL', 'ARTS', 'AUTOMOBILE', 'AVIATION', 'BANKING', 'BPO', 'BUSINESS-DEVELOPMENT', 'CHEF', 'CONSTRUCTION', 'CONSULTANT', 'DESIGNER', 'DIGITAL-MEDIA', 'ENGINEERING', 'FINANCE', 'FITNESS', 'HEALTHCARE', 'HR', 'INFORMATION-TECHNOLOGY', 'PUBLIC-RELATIONS', 'SALES', 'TEACHER']
55
  try:
 
1
 
2
  # Preprocess functions
3
  preprocess_code = """
4
+ def preprocess(text):
5
  import re
6
  import string
7
  import spacy
 
49
 
50
 
51
  postprocess_code = """
52
+ def post_process(output):
53
  import torch
54
  classes = ['ACCOUNTANT', 'ADVOCATE', 'AGRICULTURE', 'APPAREL', 'ARTS', 'AUTOMOBILE', 'AVIATION', 'BANKING', 'BPO', 'BUSINESS-DEVELOPMENT', 'CHEF', 'CONSTRUCTION', 'CONSULTANT', 'DESIGNER', 'DIGITAL-MEDIA', 'ENGINEERING', 'FINANCE', 'FITNESS', 'HEALTHCARE', 'HR', 'INFORMATION-TECHNOLOGY', 'PUBLIC-RELATIONS', 'SALES', 'TEACHER']
55
  try: