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
19 changes: 19 additions & 0 deletions .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/jpa-buddy-datasource.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/jpa-buddy.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 16 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 6 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ verify_ssl = true
[dev-packages]

[packages]
numpy = "*"
flask = "*"
keras = "*"
tensorflow = "*"
boto3 = "*"
pillow = "*"
mypy-boto3-s3 = "*"

[requires]
python_version = "3.8"
python_version = "3.11"
866 changes: 778 additions & 88 deletions Pipfile.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@
- [Flask Quickstart](https://flask.palletsprojects.com/en/2.3.x/quickstart/https://flask.palletsprojects.com/en/2.3.x/quickstart/)

## Database
- [Use PostgreSQL with Flask](https://www.digitalocean.com/community/tutorials/how-to-use-a-postgresql-database-in-a-flask-application)
- [Use PostgreSQL with Flask](https://www.digitalocean.com/community/tutorials/how-to-use-a-postgresql-database-in-a-flask-application)
- [Flask ORM can read tables it did not create](https://www.reddit.com/r/flask/comments/5n6v3t/af_trying_to_connect_to_external_readonly_db_how/)
9 changes: 7 additions & 2 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<artifactId>EZ-AI</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>EZ-AI</name>
<description>Demo project for Spring Boot</description>
<description>EZ-AI Spring Boot</description>
<properties>
<java.version>21</java.version>
</properties>
Expand All @@ -25,7 +25,6 @@
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka</artifactId>
</dependency>

<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
Expand All @@ -46,8 +45,14 @@
<artifactId>spring-kafka-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>

</dependencies>


<build>
<plugins>
<plugin>
Expand Down
7 changes: 7 additions & 0 deletions java/src/main/java/com/ezai/EZAI/EzAiApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

@SpringBootApplication
public class EzAiApplication {
Expand All @@ -10,4 +12,9 @@ public static void main(String[] args) {
SpringApplication.run(EzAiApplication.class, args);
}

@Bean
public RestTemplate getRestTemplate() {
return new RestTemplate();
}

}
17 changes: 17 additions & 0 deletions java/src/main/java/com/ezai/EZAI/controller/EzAiController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.ezai.EZAI.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class EzAiController {
@Autowired
RestTemplate restTemplate;

@RequestMapping("/test")
public String testMethod() {
return "Pass";
}
}
43 changes: 43 additions & 0 deletions java/src/main/java/com/ezai/EZAI/controller/UserController.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.ezai.EZAI.controller;

import com.ezai.EZAI.entity.User;
import com.ezai.EZAI.repository.UserRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import static org.springframework.web.bind.annotation.RequestMethod.GET;
import static org.springframework.web.bind.annotation.RequestMethod.POST;

@RestController
@RequestMapping("/user")
public class UserController {
@Autowired
RestTemplate restTemplate;

private final UserRepo userRepo;

public UserController(UserRepo userRepo) {
this.userRepo = userRepo;
}

@RequestMapping(method = {GET}, path = "/retrieveAll")
public ResponseEntity getAllUsers(){
return ResponseEntity.ok(this.userRepo.findAll());
}

@RequestMapping(method = {GET}, path = "/retrieve")
public ResponseEntity getByEmail(@RequestParam String email){
return ResponseEntity.ok(this.userRepo.findByEmail(email));
}

@RequestMapping(method = {POST}, path = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
public void addUser(@RequestBody User user){
userRepo.save(user);
}
}
30 changes: 30 additions & 0 deletions java/src/main/java/com/ezai/EZAI/entity/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package com.ezai.EZAI.entity;

import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import lombok.Getter;
import lombok.Setter;

@Setter
@Getter
@Entity(name = "User")
@Table(name = "users")
public class User {
@Id
private String email;
private String firstName;
private String lastName;
private String info;

public User() {
}

public User(String email, String firstName, String lastName, String info) {
this.email = email;
this.firstName = firstName;
this.lastName = lastName;
this.info = info;
}

}
10 changes: 10 additions & 0 deletions java/src/main/java/com/ezai/EZAI/repository/UserRepo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.ezai.EZAI.repository;

import com.ezai.EZAI.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

@Repository
public interface UserRepo extends JpaRepository<User, String> {
User findByEmail(String email);
}
7 changes: 6 additions & 1 deletion java/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@

spring.datasource.url = jdbc:postgresql://localhost:5432/EzAiDB
spring.datasource.username = postgres
spring.datasource.password = ${POSTGRES_PASSWORD}
spring.jpa.properties.hibernate,dialect = org.hibernate.dialect.PostgreSQLDialect
spring.jpa.hibernate.ddl-auto = update
spring.jpa.show-sql = true
11 changes: 11 additions & 0 deletions ml_backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,14 @@ def upload():
source_path = "tmp/dummy.keras"
s3_destination_path = "models/01/dummy.keras"
return utils.upload_to_s3(app, source_path, s3_destination_path)

@app.route("/get_images")
def get_image():
images, labels = utils.get_images_and_labels_from_s3(app, 1)
print(len(images))
print(len(labels))

print(images[0])
print(labels[0])

return "<p>Success!</p>"
Loading