microhum commited on
Commit
eccc0c5
·
1 Parent(s): 1c52ea9
Files changed (2) hide show
  1. Dockerfile +3 -3
  2. generate.py +10 -3
Dockerfile CHANGED
@@ -3,11 +3,11 @@ RUN apt-get -y update && apt-get -y install software-properties-common && apt-ge
3
  && add-apt-repository -y ppa:deadsnakes/ppa && apt-get -y install python3.10 && apt-get -y install python3-pip
4
 
5
  # Set home to the user's home directory
6
- ENV HOME=/home/
7
 
8
- WORKDIR $HOME/app
9
 
10
- COPY . $HOME/app
11
 
12
  COPY ./packages.txt /code/packages.txt
13
  RUN xargs apt-get install -y </code/packages.txt
 
3
  && add-apt-repository -y ppa:deadsnakes/ppa && apt-get -y install python3.10 && apt-get -y install python3-pip
4
 
5
  # Set home to the user's home directory
6
+ ENV HOME=/home/app
7
 
8
+ WORKDIR $HOME
9
 
10
+ COPY . $HOME
11
 
12
  COPY ./packages.txt /code/packages.txt
13
  RUN xargs apt-get install -y </code/packages.txt
generate.py CHANGED
@@ -62,6 +62,13 @@ opts.streamlit = True
62
  # [(90, 'ษ'), (91, 'ส'), (92, 'ห'), (93, 'ฬ'), (94, 'อ')]
63
  # [(95, 'ฮ')]
64
 
 
 
 
 
 
 
 
65
  import string
66
 
67
  thai_digits = [*'๐๑๒๓๔๕๖๗๘๙']
@@ -81,10 +88,10 @@ directories = [
81
 
82
  # Data Preprocessing
83
  def preprocessing(ttf_file) -> str:
84
- if os.path.exists("inference"):
85
- shutil.rmtree("inference")
86
  for directory in directories:
87
- os.makedirs(directory, exist_ok=True)
88
 
89
  # Save File / Copy File
90
  if isinstance(ttf_file, memoryview):
 
62
  # [(90, 'ษ'), (91, 'ส'), (92, 'ห'), (93, 'ฬ'), (94, 'อ')]
63
  # [(95, 'ฮ')]
64
 
65
+ # ON_PRODUCTION = True
66
+ # if ON_PRODUCTION:
67
+ # start_path = os.getcwd()
68
+ # opts.data_path = os.path.join(start_path, "inference")
69
+ # else:
70
+ # start_path = ""
71
+
72
  import string
73
 
74
  thai_digits = [*'๐๑๒๓๔๕๖๗๘๙']
 
88
 
89
  # Data Preprocessing
90
  def preprocessing(ttf_file) -> str:
91
+ if os.path.exists(opts.data_path):
92
+ shutil.rmtree(opts.data_path) # Remove Inference Folder
93
  for directory in directories:
94
+ os.makedirs(os.path.join(".", directory), exist_ok=True)
95
 
96
  # Save File / Copy File
97
  if isinstance(ttf_file, memoryview):