nirmalya8 commited on
Commit
4c4d71e
β€’
1 Parent(s): e0972e3

Restructured Files

Browse files
app.py CHANGED
@@ -8,16 +8,16 @@ import numpy as np
8
  from sklearn.feature_extraction.text import TfidfVectorizer
9
  from sklearn.model_selection import train_test_split
10
  from sklearn.metrics import classification_report
11
- from tfidf import set_paths, read_data, preprocess, training_utils, tfidf
12
- from check import find_closest_match
13
- from check import is_str_in
14
  #tfidf = TfidfVectorizer(max_features=300, stop_words="english")
15
  import streamlit as st
16
 
17
  st.title("Expense Tagging")
18
  st.subheader("Upload a txt file with each line containing a brand, we'll tell you their categories")
19
 
20
- file_name = "brands.json"
21
  with open(file_name,'r') as f:
22
  data = json.load(f)
23
  brands = []
@@ -34,10 +34,10 @@ for k in data.keys():
34
  #if bo:
35
  # print(categories[ind])
36
  #print(categories[b])
37
- filename = 'final_lr1.sav'
38
  loaded_model = pickle.load(open(filename, 'rb'))
39
 
40
- with open('tfidf2.pickle','rb') as to_read:
41
  fitted_tfidf = pickle.load(to_read)
42
 
43
  map_dict = {0:"Food and Groceries", 1:"Medical and Healthcare",2:"Education",3:"Lifestyle and Entertainment",4:"Travel & Transportation",5:"Clothing"}
 
8
  from sklearn.feature_extraction.text import TfidfVectorizer
9
  from sklearn.model_selection import train_test_split
10
  from sklearn.metrics import classification_report
11
+ from src.tfidf import set_paths, read_data, preprocess, training_utils, tfidf
12
+ from src.check import find_closest_match
13
+ from src.check import is_str_in
14
  #tfidf = TfidfVectorizer(max_features=300, stop_words="english")
15
  import streamlit as st
16
 
17
  st.title("Expense Tagging")
18
  st.subheader("Upload a txt file with each line containing a brand, we'll tell you their categories")
19
 
20
+ file_name = "src/brands.json"
21
  with open(file_name,'r') as f:
22
  data = json.load(f)
23
  brands = []
 
34
  #if bo:
35
  # print(categories[ind])
36
  #print(categories[b])
37
+ filename = 'src/Models/final_lr1.sav'
38
  loaded_model = pickle.load(open(filename, 'rb'))
39
 
40
+ with open('src/Models/tfidf2.pickle','rb') as to_read:
41
  fitted_tfidf = pickle.load(to_read)
42
 
43
  map_dict = {0:"Food and Groceries", 1:"Medical and Healthcare",2:"Education",3:"Lifestyle and Entertainment",4:"Travel & Transportation",5:"Clothing"}
{Data β†’ src/Data}/Consolidated Expense Tagging.xlsx RENAMED
File without changes
brands.txt β†’ src/Misc/brands.txt RENAMED
File without changes
categories.txt β†’ src/Misc/categories.txt RENAMED
File without changes
hyperparams.txt β†’ src/Misc/hyperparams.txt RENAMED
File without changes
final_lr.sav β†’ src/Models/final_lr.sav RENAMED
File without changes
final_lr1.sav β†’ src/Models/final_lr1.sav RENAMED
File without changes
finalized_model.sav β†’ src/Models/finalized_model.sav RENAMED
File without changes
finalized_model1.sav β†’ src/Models/finalized_model1.sav RENAMED
File without changes
tfidf.pickle β†’ src/Models/tfidf.pickle RENAMED
File without changes
tfidf2.pickle β†’ src/Models/tfidf2.pickle RENAMED
File without changes
src/__pycache__/check.cpython-310.pyc ADDED
Binary file (897 Bytes). View file
 
src/__pycache__/tfidf.cpython-310.pyc ADDED
Binary file (4.73 kB). View file
 
brands.json β†’ src/brands.json RENAMED
File without changes
check.py β†’ src/check.py RENAMED
File without changes
get_brands.py β†’ src/get_brands.py RENAMED
@@ -2,8 +2,8 @@
2
  # -*- coding: utf-8 -*-
3
  import json
4
  def get_brands_json():
5
- brands_file = 'brands.txt'
6
- categories_file = 'categories.txt'
7
 
8
  with open(brands_file) as f:
9
  brands = [line.rstrip() for line in f]
 
2
  # -*- coding: utf-8 -*-
3
  import json
4
  def get_brands_json():
5
+ brands_file = 'Misc/brands.txt'
6
+ categories_file = 'Misc/categories.txt'
7
 
8
  with open(brands_file) as f:
9
  brands = [line.rstrip() for line in f]
tfidf.py β†’ src/tfidf.py RENAMED
File without changes