From 5c5aa02ae2d682318565e81269e82fc45f222dd1 Mon Sep 17 00:00:00 2001
From: Julian <julian@edyoucated.org>
Date: Sun, 21 Apr 2024 10:28:55 +0200
Subject: [PATCH] added small nltk and spacy data sets

---
 Dockerfile       |  5 +++++
 my_callbacks.py  | 21 +++++++++++++++++++++
 my_layout.py     | 13 +++++++++++++
 requirements.txt |  3 +++
 4 files changed, 42 insertions(+)
 create mode 100644 my_callbacks.py
 create mode 100644 my_layout.py

diff --git a/Dockerfile b/Dockerfile
index 2bea9fa..6349f47 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -18,3 +18,8 @@ ENV CONFIG_PATH=/home/jovyan/config.txt
 
 COPY app /dash/app/
 RUN chown -R jovyan /dash/app/
+
+# install some NLTK and spaCy data
+RUN python -m nltk.downloader stopwords
+RUN python -m nltk.downloader wordnet
+RUN python -m spacy download en_core_web_sm
diff --git a/my_callbacks.py b/my_callbacks.py
new file mode 100644
index 0000000..6640c9d
--- /dev/null
+++ b/my_callbacks.py
@@ -0,0 +1,21 @@
+from dash.dependencies import (
+    Input, 
+    Output
+)
+from dash import html
+
+
+def register_callbacks(app):
+    @app.callback(
+        Output('output-container-button', 'children'),
+        [Input('submit-btn', 'n_clicks')],
+        [Input('input-text', 'value')]
+    )
+    def update_output(n_clicks, input_value):
+        if n_clicks > 0:
+            return html.Div([
+                html.Label("You entered:"),
+                html.P(input_value)
+            ])
+        else:
+            return ''
diff --git a/my_layout.py b/my_layout.py
new file mode 100644
index 0000000..e0cf7c4
--- /dev/null
+++ b/my_layout.py
@@ -0,0 +1,13 @@
+from dash import html
+from dash import dcc
+
+
+layout = html.Div([
+    html.H1("Yeay, my app!"),
+    html.Div([
+        html.Label("Enter your text:"),
+        dcc.Input(id='input-text', type='text', value=''),
+        html.Button('Submit', id='submit-btn', n_clicks=0),
+    ]),
+    html.Div(id='output-container-button')
+])
diff --git a/requirements.txt b/requirements.txt
index 5338915..20b821c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -11,5 +11,8 @@ plotly
 openai
 rapidfuzz
 nltk
+spacy
+scikit-learn
 
 python-dotenv
+
-- 
GitLab