Skip to content

Commit e12045e

Browse files
committed
add express app
1 parent fc99380 commit e12045e

File tree

8 files changed

+1669
-2
lines changed

8 files changed

+1669
-2
lines changed

README.md

+34-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,34 @@
1-
# example-expressjs
2-
Example PostgresML application using Express JS
1+
# Express JS PostgresML example
2+
3+
## Overview
4+
The purpose of this repository is to demonstrates how to quickly get up and running with machine learning in an Express application.
5+
6+
This application is a simple note taking application. It analyzes all the notes taken in a day and performs summarization and sentiment analysis on them.
7+
8+
All our ML occurs in the database where the notes are stored. This means just by connecting to the database we are able to train and deploy ML/AI models and have a production ready pipeline.
9+
10+
## Setup
11+
This example application requires a PostgreSQL database with the pgml and pgvector extension installed. The easiest way to do this is with a free database at [postgresml.org](https://postgresml.org/).
12+
13+
Clone this repository. Once you have your PostgresML database, or local PostgreSQL with the extensions installed, create a .env file and add `DATABASE_URL=<your_db_url>` replacing your_db_url.
14+
15+
Next install all required node packages with `node install`.
16+
17+
## Running the app
18+
Start the express server by running the following
19+
20+
```bash
21+
npm run devStart
22+
```
23+
24+
This will launch the application at [localhost:3000](http://localhost:3000/)
25+
26+
## Usage
27+
In a browser, navigate to localhost:3000. Recored a note in the text area on the left and click submit. Do this a couple times. On the right click Analyze Day, this will produce a sentiment analysis score and a summarization of your day.
28+
29+
## Code
30+
We can augment this code to perform all types of ML. Checkout the [postgresML docs](https://postgresml.org/docs/api/sql-extension/) for a full list.
31+
32+
If you are unhappy with the quality of the results, rest assured, higher quality models are available.
33+
34+
In this example we directly interacted with the extension using PostgreSQL. If you would prefer JS, see our [JS SDK](https://postgresml.org/docs/api/client-sdk/)

assets/css/style.css

+110
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
body {
2+
background-color: #212224;
3+
color: white;
4+
}
5+
6+
h1 {
7+
color: #fff;
8+
}
9+
10+
form, .note-container {
11+
width: 75%;
12+
}
13+
14+
.left-container {
15+
background-color: #212224;
16+
}
17+
18+
.right-container {
19+
background-color: #17181a;
20+
}
21+
22+
.daily-recap-container {
23+
background-color: #17181a;
24+
min-width: 30rem;
25+
}
26+
27+
.note-date {
28+
color: #abacb0;
29+
}
30+
31+
.btn-primary {
32+
--bs-btn-padding-x: 1rem;
33+
--bs-btn-padding-y: 1rem;
34+
--bs-btn-bg: #5162FF;
35+
--bs-btn-hover-bg: #7381FF;
36+
--bs-btn-active-bg: #7381FF;
37+
--bs-btn-line-height: 16px;
38+
39+
border: 0px;
40+
}
41+
42+
.glow-1 {
43+
overflow: hidden;
44+
left: 50%;
45+
top: 65%;
46+
position: absolute;
47+
width: 1329.767px;
48+
height: 602.685px;
49+
transform: rotate(-47.563deg);
50+
flex-shrink: 0;
51+
border-radius: 1329.767px;
52+
background: radial-gradient(76.18% 64.48% at 55.97% 35.8%, rgba(255, 152, 214, 0.60) 0%, rgba(26, 6, 255, 0.60) 73.96%);
53+
filter: blur(168.74745178222656px);
54+
}
55+
56+
.glow-2 {
57+
overflow: hidden;
58+
left: 50%;
59+
top: 65%;
60+
position: absolute;
61+
width: 521.519px;
62+
height: 665.196px;
63+
transform: rotate(-138.124deg);
64+
flex-shrink: 0;
65+
border-radius: 665.196px;
66+
background: radial-gradient(55.54% 61.91% at 93.5% 14.5%, rgba(66, 132, 199, 0.40) 0%, rgba(152, 203, 255, 0.40) 100%);
67+
filter: blur(112.498291015625px);
68+
}
69+
70+
.glow-3 {
71+
overflow: hidden;
72+
left: 50%;
73+
top: 65%;
74+
position: absolute;
75+
width: 608.173px;
76+
height: 456.083px;
77+
transform: rotate(-39.836deg);
78+
flex-shrink: 0;
79+
border-radius: 608.173px;
80+
background: radial-gradient(50% 50% at 50% 50%, #8B44FF 0%, #FF783F 100%);
81+
filter: blur(168.74745178222656px);
82+
}
83+
84+
.glow-4 {
85+
left: 50%;
86+
top: 65%;
87+
width: 726.853px;
88+
height: 371.406px;
89+
overflow: hidden;
90+
position: absolute;
91+
transform: rotate(-59.934deg);
92+
flex-shrink: 0;
93+
border-radius: 726.853px;
94+
background: radial-gradient(46.38% 45.17% at 22.72% 36.9%, rgba(85, 66, 199, 0.60) 26.4%, rgba(174, 110, 255, 0.60) 100%);
95+
filter: blur(224.99658203125px);
96+
}
97+
98+
.glow-5 {
99+
overflow: hidden;
100+
position: absolute;
101+
left: 50%;
102+
top: -75px;
103+
width: 121.519px;
104+
height: 265.196px;
105+
transform: rotate(-138.124deg);
106+
flex-shrink: 0;
107+
border-radius: 665.196px;
108+
background: radial-gradient(55.54% 61.91% at 93.5% 14.5%, rgba(66, 132, 199, 0.40) 0%, rgba(152, 203, 255, 0.40) 100%);
109+
filter: blur(112.498291015625px);
110+
}

assets/images/owl_gradient.png

107 KB
Loading

0 commit comments

Comments
 (0)