Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ Node.js is a runtime environment that is used to run Javascript code and is need

c. Check for **C:\Program Files\nodejs\\** in the list of paths that appear. If it's not there, click on New and add it to the list. Restart VSCode and it should work now.

#### Python
We need to download python locally to run our Flask server.
1. Please download Python here: https://www.python.org/downloads/. Be sure to download the correct installer as per your system (Windows/MacOS)
2. Run the Installer.

## Repository
To use git's version control, let's create and set up our repo :>

Expand Down Expand Up @@ -88,13 +93,26 @@ cheatsheet: https://education.github.com/git-cheat-sheet-education.pdf
[Some devices use **pip** while others use **pip3**. run ```pip --version``` or ```pip3 --version``` on a terminal to check which version you've got]

Run these commands to set up your python virtual environment with necessary dependencies:

First, go to the server directory.
```bash
cd server
```

Next, create a virtual environment. This is always a goood practice when you run any Python project locally on your device. (This is not needed when running on Google Collab!)
```bash
python -m venv venv
```
Activate your virtual environment:
```bash
# Windows users:
.\venv\Scripts\activate
# Mac/Linux users:
source venv/bin/activate
```

Install all the python dependencies (like numpy, pandas, etc)
```bash
pip install -r requirements.txt
```

Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/MLProjects/_components/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dotenv.config();

const Analysis = () => {
const [imageUrl, setImageUrl] = useState('');
const local_server_endpoint = "https://aiscworkshop2024-production.up.railway.app"
const local_server_endpoint = "http://localhost:8080" // TODO
useEffect(() => {
const fetchImage = async () => {
try {
Expand Down
2 changes: 1 addition & 1 deletion frontend/pages/MLProjects/_components/graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import axios from "axios";

const Graph = () => {
const [imageUrl, setImageUrl] = useState('');
const local_server_endpoint = "https://aiscworkshop2024-production.up.railway.app"
const local_server_endpoint = "http://localhost:8080" // TODO
useEffect(() => {
const fetchImage = async () => {
try {
Expand Down
43 changes: 43 additions & 0 deletions frontend/pages/MLProjects/_components/indexMSG.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { useEffect, useState } from "react";
import axios from "axios";

// 'message': "Hello world!",
// 'people': ["Aa", "Bb", "Cc"]


const IndexMSG = () => {
const [msg, setMsg] = useState(null);

console.log("HERE");
useEffect(() => {
const fetchMsg = async () => {
try {
const res = await axios.get("http://localhost:8080");
console.log("RES", res);
setMsg(res.data);
} catch (error) {
console.log(error);
}
}
fetchMsg();
}, []);

return (
<div>
<h1>DUMMY MESSAGE</h1>
{/* {msg ? <h1>{msg}</h1> : <h1>LOADING...</h1>} */}
{msg ? (
<div>
<h1>{msg.message}</h1>
{msg.people.map((person, index) => (
<h1 key={index}>{person}</h1>
))}
</div>
) : (
<h1>LOADING...</h1>
)}
</div>
)
}

export default IndexMSG;
2 changes: 1 addition & 1 deletion frontend/pages/MLProjects/_components/models.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import axios from "axios";
const Models = ({ props }) => {
// const [modelData, setModelData] = useState<ModelData | null>(null);
const [modelData, setModelData] = useState(null);
const local_server_endpoint = "https://aiscworkshop2024-production.up.railway.app"
const local_server_endpoint = "http://localhost:8080" // TODO

useEffect(() => {
const fetchModelData = async () => {
Expand Down
5 changes: 0 additions & 5 deletions frontend/pages/about.js
Original file line number Diff line number Diff line change
@@ -1,5 +0,0 @@
export default function About() {
return(
<div> this is the About Page</div>
)
}
17 changes: 8 additions & 9 deletions frontend/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@


export default function Home() {
return (
<div >
this is hackdavis home page.

import IndexMSG from "./MLProjects/_components/indexMSG"
export default function Home(){
return(
<div>
<h1> Hola </h1>
<IndexMSG/>
</div>
);
}
)
}
21 changes: 21 additions & 0 deletions server/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Alphasec

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
1 change: 1 addition & 0 deletions server/Procfile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
web: gunicorn --timeout 300 server:app
Binary file removed server/analysis.png
Binary file not shown.
1 change: 1 addition & 0 deletions server/eda.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# exploratory data analysis
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
Expand Down
Binary file modified server/first_graph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified server/requirements.txt
Binary file not shown.
19 changes: 19 additions & 0 deletions server/vercel.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"version": 2,
"builds": [
{
"src": "main.py",
"use": "@vercel/python"
}
],
"routes": [
{
"src": "/(.*)",
"dest": "/main.py"
}
],
"env": {
"FLASK_ENV": "production",
"FLASK_APP": "main.py"
}
}