Pietro Lesci commited on
Commit
a67a34c
1 Parent(s): 31a7be9

update to python 3.10

Browse files
Files changed (6) hide show
  1. Dockerfile +1 -1
  2. Makefile +1 -1
  3. README.md +1 -1
  4. app.py +7 -5
  5. requirements.txt +7 -8
  6. src/utils.py +3 -3
Dockerfile CHANGED
@@ -1,4 +1,4 @@
1
- FROM python:3.7
2
 
3
  COPY . /var/app/
4
  WORKDIR /var/app
 
1
+ FROM python:3.10
2
 
3
  COPY . /var/app/
4
  WORKDIR /var/app
Makefile CHANGED
@@ -1,6 +1,6 @@
1
  # Docker image build info
2
  PROJECT:=wordify
3
- BUILD_TAG?=v2.0
4
  sources = src
5
 
6
  ########################################################
 
1
  # Docker image build info
2
  PROJECT:=wordify
3
+ BUILD_TAG?=v2.1
4
  sources = src
5
 
6
  ########################################################
README.md CHANGED
@@ -3,7 +3,7 @@ title: Wordify
3
  emoji: 🤗
4
  colorFrom: blue
5
  colorTo: blue
6
- python_version: 3.7
7
  sdk: streamlit
8
  sdk_version: 1.17.0
9
  app_file: app.py
 
3
  emoji: 🤗
4
  colorFrom: blue
5
  colorTo: blue
6
+ python_version: 3.11
7
  sdk: streamlit
8
  sdk_version: 1.17.0
9
  app_file: app.py
app.py CHANGED
@@ -1,9 +1,5 @@
1
  import streamlit as st
2
 
3
- from src.components import analysis, docs, faq, footer, form, presentation
4
- from src.configs import SupportedFiles
5
- from src.utils import convert_df, get_logo, read_file
6
-
7
  # app configs
8
  st.set_page_config(
9
  page_title="Wordify",
@@ -14,9 +10,15 @@ st.set_page_config(
14
  "Get Help": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
15
  "Report a Bug": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
16
  "About": "By the __Wordify__ team.",
17
- },
18
  )
19
 
 
 
 
 
 
 
20
  # logo
21
  st.sidebar.image(get_logo("./assets/logo.png"))
22
 
 
1
  import streamlit as st
2
 
 
 
 
 
3
  # app configs
4
  st.set_page_config(
5
  page_title="Wordify",
 
10
  "Get Help": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
11
  "Report a Bug": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
12
  "About": "By the __Wordify__ team.",
13
+ }, # type: ignore
14
  )
15
 
16
+ # HACK: other streamlit complains that `set_page_config` is not the first command
17
+ if True:
18
+ from src.components import analysis, docs, faq, footer, form, presentation
19
+ from src.configs import SupportedFiles
20
+ from src.utils import convert_df, get_logo, read_file
21
+
22
  # logo
23
  st.sidebar.image(get_logo("./assets/logo.png"))
24
 
requirements.txt CHANGED
@@ -1,16 +1,15 @@
1
- streamlit==1.17
2
- pandas==1.3.4
 
 
3
  textacy==0.11.0
4
  spacy==3.2.0
5
- scikit-learn==1.0.1
6
  xlrd==2.0.1
7
  openpyxl==3.0.9
8
- watchdog==2.1.6
9
- vaex==4.7.0
10
- blake3==0.2.1 # to make vaex work
11
- protobuf~=3.19.0
12
 
13
- # english
 
14
  https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0.tar.gz#egg=en_core_web_sm
15
  # italian
16
  https://github.com/explosion/spacy-models/releases/download/it_core_news_sm-3.2.0/it_core_news_sm-3.2.0.tar.gz#egg=it_core_news_sm
 
1
+ watchdog==2.1.6
2
+ vaex==4.17.0
3
+ streamlit==1.33.0
4
+ pandas==2.2.2
5
  textacy==0.11.0
6
  spacy==3.2.0
7
+ scikit-learn==1.4.2
8
  xlrd==2.0.1
9
  openpyxl==3.0.9
 
 
 
 
10
 
11
+
12
+ # # english
13
  https://github.com/explosion/spacy-models/releases/download/en_core_web_sm-3.2.0/en_core_web_sm-3.2.0.tar.gz#egg=en_core_web_sm
14
  # italian
15
  https://github.com/explosion/spacy-models/releases/download/it_core_news_sm-3.2.0/it_core_news_sm-3.2.0.tar.gz#egg=it_core_news_sm
src/utils.py CHANGED
@@ -24,12 +24,12 @@ def get_col_indices(cols: List) -> Tuple[int, int]:
24
  return text_index, label_index
25
 
26
 
27
- @st.cache
28
  def get_logo(path: str) -> Image:
29
  return Image.open(path)
30
 
31
 
32
- @st.experimental_memo
33
  def read_file(uploaded_file) -> DataFrame:
34
  file_type = uploaded_file.name.split(".")[-1]
35
  read_fn = SupportedFiles[file_type].value[0]
@@ -38,7 +38,7 @@ def read_file(uploaded_file) -> DataFrame:
38
  return df
39
 
40
 
41
- @st.cache
42
  def convert_df(df: DataFrame) -> bytes:
43
  # IMPORTANT: Cache the conversion to prevent computation on every rerun
44
  return df.to_csv(index=False, sep=";").encode("utf-8")
 
24
  return text_index, label_index
25
 
26
 
27
+ @st.cache_data
28
  def get_logo(path: str) -> Image:
29
  return Image.open(path)
30
 
31
 
32
+ @st.cache_data
33
  def read_file(uploaded_file) -> DataFrame:
34
  file_type = uploaded_file.name.split(".")[-1]
35
  read_fn = SupportedFiles[file_type].value[0]
 
38
  return df
39
 
40
 
41
+ @st.cache_data
42
  def convert_df(df: DataFrame) -> bytes:
43
  # IMPORTANT: Cache the conversion to prevent computation on every rerun
44
  return df.to_csv(index=False, sep=";").encode("utf-8")