Skip to content

Commit

Permalink
update to python 3.10
Browse files Browse the repository at this point in the history
  • Loading branch information
pietrolesci committed Apr 11, 2024
1 parent 31a7be9 commit a67a34c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 19 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.7
FROM python:3.10

COPY . /var/app/
WORKDIR /var/app
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Docker image build info
PROJECT:=wordify
BUILD_TAG?=v2.0
BUILD_TAG?=v2.1
sources = src

########################################################
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: Wordify
emoji: 🤗
colorFrom: blue
colorTo: blue
python_version: 3.7
python_version: 3.11
sdk: streamlit
sdk_version: 1.17.0
app_file: app.py
Expand Down
12 changes: 7 additions & 5 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import streamlit as st

from src.components import analysis, docs, faq, footer, form, presentation
from src.configs import SupportedFiles
from src.utils import convert_df, get_logo, read_file

# app configs
st.set_page_config(
page_title="Wordify",
Expand All @@ -14,9 +10,15 @@
"Get Help": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
"Report a Bug": "https://github.com/MilaNLProc/wordify-webapp-streamlit/issues/new",
"About": "By the __Wordify__ team.",
},
}, # type: ignore
)

# HACK: other streamlit complains that `set_page_config` is not the first command
if True:
from src.components import analysis, docs, faq, footer, form, presentation
from src.configs import SupportedFiles
from src.utils import convert_df, get_logo, read_file

# logo
st.sidebar.image(get_logo("./assets/logo.png"))

Expand Down
15 changes: 7 additions & 8 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
streamlit==1.17
pandas==1.3.4
watchdog==2.1.6
vaex==4.17.0
streamlit==1.33.0
pandas==2.2.2
textacy==0.11.0
spacy==3.2.0
scikit-learn==1.0.1
scikit-learn==1.4.2
xlrd==2.0.1
openpyxl==3.0.9
watchdog==2.1.6
vaex==4.7.0
blake3==0.2.1 # to make vaex work
protobuf~=3.19.0

# english

# # english
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
# italian
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
Expand Down
6 changes: 3 additions & 3 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def get_col_indices(cols: List) -> Tuple[int, int]:
return text_index, label_index


@st.cache
@st.cache_data
def get_logo(path: str) -> Image:
return Image.open(path)


@st.experimental_memo
@st.cache_data
def read_file(uploaded_file) -> DataFrame:
file_type = uploaded_file.name.split(".")[-1]
read_fn = SupportedFiles[file_type].value[0]
Expand All @@ -38,7 +38,7 @@ def read_file(uploaded_file) -> DataFrame:
return df


@st.cache
@st.cache_data
def convert_df(df: DataFrame) -> bytes:
# IMPORTANT: Cache the conversion to prevent computation on every rerun
return df.to_csv(index=False, sep=";").encode("utf-8")
Expand Down

0 comments on commit a67a34c

Please sign in to comment.