Skip to content

updated oracle genai, added digital double app, etc. #44

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
1d12baf
More improvements in the chatbot requirements.txt
ptptiwari Aug 19, 2024
0079205
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 5, 2024
06a766d
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 5, 2024
f5f274b
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
cfa9395
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
53064f4
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
7ae130c
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
08ffbe9
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
64f79a0
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
3231a49
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
2e54fbb
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
31c18aa
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
85cf448
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
5484f58
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
d84e919
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
5d7d90e
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
da055b4
move into javaai dir, add k8s and dockerfile and basicauth
paulparkinson Sep 6, 2024
7124cad
More improvements in the chatbot README.md
ptptiwari Sep 6, 2024
a41b789
Merge branch 'paulparkinson:main' into main
ptptiwari Sep 6, 2024
2ba2d9d
digital double logic
paulparkinson Sep 6, 2024
9262b5d
digital double logic
paulparkinson Sep 6, 2024
c58a3d7
digital double logic
paulparkinson Sep 6, 2024
cd2229d
digital double logic
paulparkinson Sep 6, 2024
3342b1a
digital double logic
paulparkinson Sep 6, 2024
f28d037
digital double logic
paulparkinson Sep 6, 2024
aeaaee9
digital double logic
paulparkinson Sep 6, 2024
d94c316
digital double logic
paulparkinson Sep 7, 2024
a635e51
digital double logic
paulparkinson Sep 7, 2024
9eeef7e
digital double logic
paulparkinson Sep 7, 2024
5b5d289
digital double logic
paulparkinson Sep 7, 2024
6caa462
digital double logic
paulparkinson Sep 7, 2024
4c54d2f
digital double logic
paulparkinson Sep 7, 2024
7dad90c
digital double logic
paulparkinson Sep 7, 2024
fbbd5b7
digital double logic
paulparkinson Sep 7, 2024
1250739
digital double logic
paulparkinson Sep 7, 2024
73c8912
digital double logic
paulparkinson Sep 7, 2024
7d0f522
Merge branch 'paulparkinson:main' into main
ptptiwari Sep 7, 2024
9fc0d90
digital double logic
paulparkinson Sep 7, 2024
de33772
digital double logic
paulparkinson Sep 7, 2024
ac7f7b0
digital double logic
paulparkinson Sep 7, 2024
76900b0
digital double logic
paulparkinson Sep 7, 2024
be86bc7
digital double logic
paulparkinson Sep 7, 2024
c8ead5d
digital double logic
paulparkinson Sep 7, 2024
e61fc4b
digital double logic
paulparkinson Sep 7, 2024
b7a27d1
digital double logic
paulparkinson Sep 7, 2024
9239c1f
digital double logic
paulparkinson Sep 7, 2024
02d41e6
digital double logic
paulparkinson Sep 8, 2024
a4ba247
digital double logic
paulparkinson Sep 8, 2024
d2cdd4c
digital double logic
paulparkinson Sep 8, 2024
e08a53d
digital double logic
paulparkinson Sep 8, 2024
bb3a9d7
digital double logic
paulparkinson Sep 8, 2024
bbf9b27
digital double logic
paulparkinson Sep 8, 2024
9846f03
digital double logic
paulparkinson Sep 8, 2024
f9fa31e
digital double logic
paulparkinson Sep 8, 2024
54986c5
digital double logic
paulparkinson Sep 8, 2024
8f14cd6
digital double logic
paulparkinson Sep 8, 2024
7f50092
Merge branch 'paulparkinson:main' into main
ptptiwari Sep 13, 2024
bfa0977
addition of TTS, calls to Audio2Face, and other logic
paulparkinson Oct 18, 2024
01815a5
Merge remote-tracking branch 'origin/main'
paulparkinson Oct 18, 2024
baddca1
Merge remote-tracking branch 'upstream/main'
paulparkinson Oct 31, 2024
8928c6f
Merge pull request #6 from ptptiwari/main
paulparkinson Nov 1, 2024
ef75e15
update to chat/genai
paulparkinson Nov 1, 2024
c87dfee
Merge remote-tracking branch 'origin/main'
paulparkinson Nov 1, 2024
ae40585
update to chat/genai
paulparkinson Nov 1, 2024
1d41fd1
update to chat/genai and new digital doubles app
paulparkinson Nov 1, 2024
664c9fb
Revert "More improvements in the code "
paulparkinson Nov 1, 2024
bdd2a29
Merge pull request #7 from paulparkinson/revert-6-main
paulparkinson Nov 1, 2024
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
14 changes: 0 additions & 14 deletions Dockerfile

This file was deleted.

5 changes: 5 additions & 0 deletions java-ai/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-alpine
#docker.io/library/openjdk:17-oracle

ADD target/oracleai-0.0.1-SNAPSHOT.jar /usr/share/oracleai/oracleai-0.0.1-SNAPSHOT.jar
ENTRYPOINT ["java", "-jar", "/usr/share/oracleai/oracleai-0.0.1-SNAPSHOT.jar"]
File renamed without changes.
21 changes: 21 additions & 0 deletions java-ai/build0.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

set -e

IMAGE_NAME=podsofkon
#IMAGE_VERSION=latest
IMAGE_VERSION=sustainableaijava
#DOCKER_REGISTRY=us-ashburn-1.ocir.io/oradbclouducm/gd74087885
DOCKER_REGISTRY=us-ashburn-1.ocir.io/oradbclouducm/podsofkon

export IMAGE=${DOCKER_REGISTRY}/${IMAGE_NAME}:${IMAGE_VERSION}
export IMAGE_VERSION=$IMAGE_VERSION

mvn clean package

#docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE .
podman build -t=$IMAGE .
#docker buildx build --platform=linux/amd64 -t=$IMAGE .

#docker push --platform linux/amd64 "$IMAGE"
podman push "$IMAGE"
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 22 additions & 0 deletions java-ai/k8s/createSecretFromWallet.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
#simply copy this file to and run it from your wallet dir...
if kubectl apply -f - ; then
echo "secret applied for wallet."
else
echo "Error: Failure to create ragdb-wallet-secret."
fi <<!
apiVersion: v1
data:
README: $(base64 -w0 README)
cwallet.sso: $(base64 -w0 cwallet.sso)
ewallet.p12: $(base64 -w0 ewallet.p12)
keystore.jks: $(base64 -w0 keystore.jks)
ojdbc.properties: $(base64 -w0 ojdbc.properties)
sqlnet.ora: $(base64 -w0 sqlnet.ora)
tnsnames.ora: $(base64 -w0 tnsnames.ora)
truststore.jks: $(base64 -w0 truststore.jks)
kind: Secret
metadata:
name: ragdb-wallet-secret
!

22 changes: 22 additions & 0 deletions java-ai/k8s/createSecretFromWalletMac.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/bash
# Simply copy this file to and run it from your wallet dir...
if kubectl apply -f - ; then
echo "secret applied for wallet in the msdataworkshop namespace."
else
echo "Error: Failure to create ragdb-wallet-secret."
fi <<!
apiVersion: v1
data:
README: $(base64 -i ./README)
cwallet.sso: $(base64 -i ./cwallet.sso)
ewallet.p12: $(base64 -i ./ewallet.p12)
keystore.jks: $(base64 -i ./keystore.jks)
ojdbc.properties: $(base64 -i ./ojdbc.properties)
sqlnet.ora: $(base64 -i ./sqlnet.ora)
tnsnames.ora: $(base64 -i ./tnsnames.ora)
truststore.jks: $(base64 -i ./truststore.jks)
kind: Secret
metadata:
name: ragdb-wallet-secret
namespace: msdataworkshop
!
3 changes: 3 additions & 0 deletions java-ai/k8s/createTLSSecret.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

kubectl create secret tls ssl-certificate-secret --key $MY_STATE/tls/tls.key --cert $MY_STATE/tls/tls.crt -n
49 changes: 49 additions & 0 deletions java-ai/k8s/java-ai-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: oraclejavaai
spec:
replicas: 1
selector:
matchLabels:
app: oraclejavaai
template:
metadata:
creationTimestamp: null
labels:
app: oraclejavaai
spec:
volumes:
- name: creds
secret:
secretName: ragdb-wallet-secret
defaultMode: 420
containers:
- name: oraclejavaai
image: us-ashburn-1.ocir.io/oradbclouducm/podsofkon/podsofkon:sustainableai
# image: us-ashburn-1.ocir.io/oradbclouducm/oraclejavaai/oraclejavaai:0.2
# image: us-ashburn-1.ocir.io/oradbclouducm/gd74087885/xr-admin:0.1
ports:
- name: http
containerPort: 8080
protocol: TCP
env:
- name: LOG_LEVEL
value: DEBUG
- name: server_port
value: '8080'
- name: spring.datasource.username
value: admin
- name: spring.datasource.url
value: jdbc:oracle:thin:@ragdb_tp?TNS_ADMIN=/oraclejavaai/creds
- name: spring.datasource.password
value: Welcome123456
resources: {}
volumeMounts:
- name: creds
mountPath: /oraclejavaai/creds
imagePullPolicy: Always
restartPolicy: Always
imagePullSecrets:
- name: regcred
schedulerName: default-scheduler
13 changes: 13 additions & 0 deletions java-ai/k8s/java-ai-services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: oraclejavaai
spec:
ports:
- protocol: TCP
port: 80
targetPort: 8080
# nodePort: 32462
selector:
app: oraclejavaai
type: LoadBalancer
9 changes: 7 additions & 2 deletions pom.xml → java-ai/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<description>Oracle AI Demos</description>

<properties>
<oci.sdk.version>3.44.2</oci.sdk.version>
<oci.sdk.version>3.52.1</oci.sdk.version>
</properties>

<dependencies>
Expand All @@ -32,10 +32,15 @@
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.oracle.cloud.spring</groupId>
<artifactId>spring-cloud-oci-starter</artifactId>
<version>1.0.0</version>
<version>1.3.0</version>
</dependency>
<dependency>
<groupId>com.oracle.oci.sdk</groupId>
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
package oracleai;

import com.oracle.bmc.retrier.RetryConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
public class AIApplication {

public static final String COMPARTMENT_ID = System.getenv("COMPARTMENT_ID");
public static final String OBJECTSTORAGE_NAMESPACE = System.getenv("OBJECTSTORAGE_NAMESPACE");
public static final String OBJECTSTORAGE_BUCKETNAME = System.getenv("OBJECTSTORAGE_BUCKETNAME");
public static final String ORDS_ENDPOINT_URL = System.getenv("ORDS_ENDPOINT_URL");
public static final String ORDS_OMLOPSENDPOINT_URL= System.getenv("ORDS_ENDPOINT_URL") + "/omlopsuser/";
public static final String OCI_VISION_SERVICE_ENDPOINT = System.getenv("OCI_VISION_SERVICE_ENDPOINT");
public static final String OCI_SPEECH_SERVICE_ENDPOINT = System.getenv("OCI_SPEECH_SERVICE_ENDPOINT");
public static final String OCI_GENAI_SERVICE_ENDPOINT = System.getenv("OCI_GENAI_SERVICE_ENDPOINT");
public static final String OCICONFIG_FILE = System.getenv("OCICONFIG_FILE");
public static final String OCICONFIG_PROFILE = System.getenv("OCICONFIG_PROFILE");
public static final String DIGITAL_DOUBLES_IMAGES_ENDPOINT = System.getenv("DIGITAL_DOUBLES_IMAGES_ENDPOINT");
public static final String THREEDEY = "msy_mykey";

static {
System.out.println("AIApplication.static initializer COMPARTMENT_ID:" + COMPARTMENT_ID);
Expand All @@ -21,8 +26,12 @@ public class AIApplication {
System.out.println("AIApplication.static initializer ORDS_ENDPOINT_URL:" + ORDS_ENDPOINT_URL);
System.out.println("AIApplication.static initializer OCI_VISION_SERVICE_ENDPOINT:" + OCI_VISION_SERVICE_ENDPOINT);
}

public static void main(String[] args) {
SpringApplication.run(AIApplication.class, args);
}
// RetryConfiguration retryConfiguration = RetryConfiguration.builder()
// .terminationStrategy(RetryUtils.createExponentialBackoffStrategy(500, 5)) // Configure limits
// .build();
SpringApplication.run(AIApplication.class, args);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.fasterxml.jackson.databind.ObjectMapper;
import com.oracle.bmc.aivision.model.ImageTextDetectionFeature;
import com.oracle.bmc.generativeaiinference.model.OnDemandServingMode;
import oracleai.services.ORDSCalls;
import oracleai.services.OracleGenAI;
import oracleai.services.OracleObjectStore;
Expand Down Expand Up @@ -43,8 +44,13 @@ public String analyzedoc(@RequestParam("file") MultipartFile multipartFile,
}
System.out.println(concatenatedText);
System.out.println("analyzedoc fullText = " + concatenatedText);
OnDemandServingMode chatServingMode = OnDemandServingMode.builder()
.modelId("cohere.command-r-16k")
.build();
String explanationOfResults =
OracleGenAI.chat("explain these test results in simple terms, in less than 100 words, " +
OracleGenAI.builder().compartment(AIApplication.COMPARTMENT_ID)
.servingMode(chatServingMode)
.build().chat("explain these test results in simple terms, in less than 100 words, " +
"and tell me what should I do to get better results: \"" + concatenatedText + "\"");
System.out.println("ExplainAndAdviseOnHealthTestResults.analyzedoc explanationOfResults:" + explanationOfResults);
model.addAttribute("results", "SUMMARY WITH ADVICE: " + explanationOfResults +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
package oracleai;


import oracleai.digitaldouble.ImageStore;
import oracleai.services.ORDSCalls;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


@Controller
@RequestMapping("/transferimage")
public class UploadDownloadImage {
Expand All @@ -23,8 +21,6 @@ public String uploadImage(@RequestParam("image") MultipartFile image, Model mode
return "images";
}



@GetMapping("/downloadimages")
public String getImageStoreData(Model model) {
ImageStore[] imageStores = ORDSCalls.getImageStoreData();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public String tellastory(@RequestParam("file") MultipartFile multipartFile, @Req
"OBJECT_DETECTION",
"TellAStory");
}
String generatedstory = OracleGenAI.chat("using strong negative and positive sentiments, " +
String generatedstory = OracleGenAI.builder().build().chat("using strong negative and positive sentiments, " +
"write a story that is " + genopts + " and includes " + fullText );
model.addAttribute("results", "STORY: " + generatedstory +
" --->SENTIMENT ANALYSIS: " + OracleLanguageAI.sentimentAnalysis(generatedstory) );
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package oracleai.common;

import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.multipart.MaxUploadSizeExceededException;

@ControllerAdvice
public class FileUploadExceptionAdvice {

@ExceptionHandler(MaxUploadSizeExceededException.class)
public ResponseEntity<String> handleMaxSizeException(MaxUploadSizeExceededException exc) {
return ResponseEntity.status(HttpStatus.EXPECTATION_FAILED).body("File too large!");
}
}
Loading