Nick Canu commited on
Commit
62fdfea
·
1 Parent(s): b3de42e

relative path update

Browse files
.gitignore CHANGED
@@ -1,3 +1,4 @@
1
  Model_Constants.py
2
  venv/
3
- Auto-BG_Workspace.code-workspace
 
 
1
  Model_Constants.py
2
  venv/
3
+ Auto-BG_Workspace.code-workspace
4
+ secrets.toml
Home.py CHANGED
@@ -15,6 +15,7 @@ def application():
15
  import gzip
16
  import io
17
  from description_generator import input_manager, model_control
 
18
 
19
  #UI Session Variables
20
  if 'desc_iter' not in st.session_state:
@@ -40,18 +41,16 @@ def application():
40
 
41
  #non-ui helper functions
42
  #reader code extended from https://gist.github.com/thearn/5424244 for alternate load format
43
- def reader(url):
44
- url_file = io.BytesIO(urllib.request.urlopen(url).read())
45
- f = gzip.GzipFile(fileobj=url_file)
46
  data = f.read()
47
  obj = pickle.loads(data)
48
  f.close()
49
  return obj
50
 
51
- def token_expand(url):
52
  nlp = spacy.blank("en")
53
- url_file = urllib.request.urlopen(url)
54
- f = gzip.GzipFile(fileobj=url_file)
55
  data = f.read()
56
  obj = pickle.loads(data)
57
  f.close()
@@ -139,9 +138,10 @@ def application():
139
  ###Data
140
  @st.cache_data
141
  def fetch_data():
142
- slim_df = pd.read_parquet('https://github.com/canunj/Auto-BoardGame/blob/main/Persistent_Data/slim_df.parquet.gzip?raw=true')
143
- search_tokens = token_expand("https://github.com/canunj/Auto-BoardGame/blob/main/Persistent_Data/token_search.gz?raw=true")
144
- vector_df = pd.read_parquet('https://github.com/canunj/Auto-BoardGame/blob/main/Persistent_Data/vector_df.parquet.gzip?raw=true')
 
145
  category_keys = reader("https://github.com/canunj/Auto-BoardGame/blob/main/Persistent_Data/current_keys.gz?raw=true")
146
  return slim_df, search_tokens, vector_df, category_keys
147
 
 
15
  import gzip
16
  import io
17
  from description_generator import input_manager, model_control
18
+ from pathlib import Path
19
 
20
  #UI Session Variables
21
  if 'desc_iter' not in st.session_state:
 
41
 
42
  #non-ui helper functions
43
  #reader code extended from https://gist.github.com/thearn/5424244 for alternate load format
44
+ def reader(path):
45
+ f = gzip.GzipFile(filename=path)
 
46
  data = f.read()
47
  obj = pickle.loads(data)
48
  f.close()
49
  return obj
50
 
51
+ def token_expand(path):
52
  nlp = spacy.blank("en")
53
+ f = gzip.GzipFile(filename=path)
 
54
  data = f.read()
55
  obj = pickle.loads(data)
56
  f.close()
 
138
  ###Data
139
  @st.cache_data
140
  def fetch_data():
141
+ #path load solution from https://stackoverflow.com/questions/69768380/share-streamlit-cant-find-pkl-file
142
+ slim_df = pd.read_parquet(Path(__file__).parent / "Persistent_Data/slim_df.parquet.gzip")
143
+ search_tokens = token_expand(Path(__file__).parent / "Persistent_Data/token_search.gz")
144
+ vector_df = pd.read_parquet(Path(__file__).parent / 'Persistent_Data/vector_df.parquet.gzip')
145
  category_keys = reader("https://github.com/canunj/Auto-BoardGame/blob/main/Persistent_Data/current_keys.gz?raw=true")
146
  return slim_df, search_tokens, vector_df, category_keys
147
 
__pycache__/description_generator.cpython-39.pyc CHANGED
Binary files a/__pycache__/description_generator.cpython-39.pyc and b/__pycache__/description_generator.cpython-39.pyc differ
 
__pycache__/title_generator.cpython-39.pyc CHANGED
Binary files a/__pycache__/title_generator.cpython-39.pyc and b/__pycache__/title_generator.cpython-39.pyc differ