Skip to content

Commit d94c316

Browse files
committed
digital double logic
1 parent aeaaee9 commit d94c316

File tree

6 files changed

+232
-18
lines changed

6 files changed

+232
-18
lines changed

java-ai/src/main/java/oracleai/DigitalDoubles.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33

44
import oracleai.services.ORDSCalls;
5+
import oracleai.services.OracleObjectStore;
56
import org.apache.tomcat.util.http.fileupload.FileUtils;
67
import org.springframework.http.ResponseEntity;
78
import org.springframework.stereotype.Controller;
@@ -30,6 +31,8 @@ public String digitaldouble(@RequestParam("action") String action, Model model)
3031
public String uploadimageandvideo(
3132
@RequestParam("image") MultipartFile image,
3233
@RequestParam("video") MultipartFile video,
34+
@RequestParam("animstyle") String animstyle,
35+
@RequestParam("animprompt") String animprompt,
3336
@RequestParam("firstName") String firstName,
3437
@RequestParam("lastName") String lastName,
3538
@RequestParam("email") String email,
@@ -39,21 +42,20 @@ public String uploadimageandvideo(
3942
@RequestParam("comments") String comments,
4043
Model model) throws IOException {
4144

42-
System.out.println("image = " + image + ", video = " + video +
45+
String commentsWithAnimStyleAndPrompt = animstyle + " " + animprompt + " " + comments;
46+
System.out.println("image = " + image + ", video = " + video +", animstyle = " + animstyle +
4347
", firstName = " + firstName + ", lastName = " + lastName +
4448
", email = " + email + ", company = " + company +
4549
", jobRole = " + jobRole + ", tshirtSize = " + tshirtSize +
46-
", comments = " + comments + ", model = " + model);
50+
", comments = " + comments + ", model = " + model +
51+
"\ncomments with animstyle and prompt = " + commentsWithAnimStyleAndPrompt);
4752
if (!image.isEmpty()) {
48-
// ORDSCalls.uploadImage(image);
53+
OracleObjectStore.sendToObjectStorage(
54+
email + "_" + video.getOriginalFilename(), video.getInputStream());
4955
ORDSCalls.insertDigitalDoubleData(
50-
image,video,firstName,lastName, email, company,jobRole, tshirtSize, comments);
51-
// byte[] imageBytes = image.getBytes();
52-
56+
image,null, firstName, lastName, email, company,jobRole, tshirtSize, commentsWithAnimStyleAndPrompt);
5357
if (!video.isEmpty()) {
54-
// Do something with the video file
55-
byte[] videoBytes = video.getBytes();
56-
// Save or process the video
58+
// byte[] videoBytes = video.getBytes();
5759
}
5860
try {
5961
org.apache.commons.io.FileUtils.forceMkdir(new File(DIRECTORY));

java-ai/src/main/java/oracleai/DigitalDoubleDataRequest.java renamed to java-ai/src/main/java/oracleai/services/DigitalDoubleDataRequest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package oracleai;
1+
package oracleai.services;
22

33
public class DigitalDoubleDataRequest {
44
public String p_participant_firstname;

java-ai/src/main/java/oracleai/DigitalDoubleORDS.java renamed to java-ai/src/main/java/oracleai/services/DigitalDoubleORDS.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package oracleai;
1+
package oracleai.services;
22

33
import org.springframework.http.HttpEntity;
44
import org.springframework.http.HttpHeaders;

java-ai/src/main/java/oracleai/services/OracleObjectStore.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@
99
import oracleai.AIApplication;
1010

1111
import java.io.BufferedReader;
12+
import java.io.IOException;
1213
import java.io.InputStream;
1314
import java.io.InputStreamReader;
1415
import java.nio.charset.StandardCharsets;
1516

1617
public class OracleObjectStore {
1718

1819

19-
public static void sendToObjectStorage(String fileName, InputStream inputStreamForFile) throws Exception {
20+
public static void sendToObjectStorage(String fileName, InputStream inputStreamForFile) throws IOException {
2021
System.out.println("GenerateAPictureStoryUsingOnlySpeech.sendToObjectStorage fileToUpload:" + fileName);
2122
BasicAuthenticationDetailsProvider provider = AuthProvider.getAuthenticationDetailsProvider();
2223
ObjectStorageClient client = ObjectStorageClient.builder().build(provider);
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
<!DOCTYPE html>
2+
<html lang="en" xmlns:th="http://www.thymeleaf.org">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Player Form</title>
7+
<style>
8+
body {
9+
font-family: Arial, sans-serif;
10+
display: flex;
11+
justify-content: center;
12+
align-items: center;
13+
height: 100vh;
14+
margin: 0;
15+
background-color: #f0f0f0;
16+
}
17+
.container {
18+
text-align: center;
19+
background-color: #fff;
20+
padding: 20px;
21+
border-radius: 10px;
22+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
23+
}
24+
h1 {
25+
color: #333;
26+
}
27+
.form-group {
28+
margin: 15px 0;
29+
}
30+
label {
31+
display: block;
32+
margin-bottom: 5px;
33+
color: #333;
34+
}
35+
input[type="text"],
36+
input[type="email"],
37+
input[type="company"],
38+
input[type="jobrole"],
39+
input[type="tshirtsize"],
40+
input[type="comments"],
41+
select {
42+
width: 100%;
43+
padding: 10px;
44+
margin: 5px 0 20px 0;
45+
border: 1px solid #ccc;
46+
border-radius: 5px;
47+
box-sizing: border-box;
48+
}
49+
.row {
50+
display: flex;
51+
gap: 10px;
52+
}
53+
.row select,
54+
.row input {
55+
width: 48%;
56+
}
57+
input[type="submit"] {
58+
background-color: #007BFF;
59+
color: white;
60+
border: none;
61+
padding: 15px 30px;
62+
text-align: center;
63+
text-decoration: none;
64+
display: inline-block;
65+
font-size: 16px;
66+
margin: 10px 5px;
67+
border-radius: 5px;
68+
cursor: pointer;
69+
transition: background-color 0.3s;
70+
}
71+
input[type="submit"]:hover {
72+
background-color: #0056b3;
73+
}
74+
</style>
75+
</head>
76+
<body>
77+
<div class="container">
78+
<h1>Please provide image and/or video and some basic info...</h1>
79+
<form method="post" action="/digitaldoubles/uploadimageandvideo" enctype="multipart/form-data">
80+
81+
<label for="image">Select image:</label>
82+
<input type="file" id="image" name="image" accept="image/*" required>
83+
84+
<label for="video">Select video:</label>
85+
<input type="file" id="video" name="video" accept="video/*" required>
86+
87+
<!-- Dropdown for Animation Style and Text Field for Animation Prompt -->
88+
<div class="row">
89+
<div>
90+
<label for="animstyle">Select Animation Style:</label>
91+
<select id="animstyle" name="animstyle">
92+
<option value="style1">Style 1</option>
93+
<option value="style2">Style 2</option>
94+
<option value="style3">Style 3</option>
95+
<option value="style4">Style 4</option>
96+
<option value="style5">Style 5</option>
97+
<option value="style6">Style 6</option>
98+
<option value="style7">Style 7</option>
99+
<option value="style8">Style 8</option>
100+
<option value="style9">Style 9</option>
101+
<option value="style10">Style 10</option>
102+
<option value="style11">Style 11</option>
103+
<option value="style12">Style 12</option>
104+
<option value="style13">Style 13</option>
105+
<option value="style14">Style 14</option>
106+
<option value="style15">Style 15</option>
107+
<option value="style16">Style 16</option>
108+
<option value="style17">Style 17</option>
109+
<option value="style18">Style 18</option>
110+
<option value="style19">Style 19</option>
111+
<option value="style20">Style 20</option>
112+
<option value="style21">Style 21</option>
113+
<option value="style22">Style 22</option>
114+
<option value="style23">Style 23</option>
115+
<option value="style24">Style 24</option>
116+
<option value="style25">Style 25</option>
117+
<option value="style26">Style 26</option>
118+
<option value="style27">Style 27</option>
119+
<option value="style28">Style 28</option>
120+
<option value="style29">Style 29</option>
121+
<option value="style30">Style 30</option>
122+
<option value="style31">Style 31</option>
123+
<option value="style32">Style 32</option>
124+
<option value="style33">Style 33</option>
125+
<option value="style34">Style 34</option>
126+
<option value="style35">Style 35</option>
127+
</select>
128+
</div>
129+
<div>
130+
<label for="animprompt">Animation Prompt:</label>
131+
<input type="text" id="animprompt" name="animprompt" placeholder="Describe your animation">
132+
</div>
133+
</div>
134+
135+
<div class="form-group">
136+
<label for="firstName">First Name:</label>
137+
<input type="text" id="firstName" name="firstName" autocomplete="given-name">
138+
</div>
139+
<div class="form-group">
140+
<label for="lastName">Last Name:</label>
141+
<input type="text" id="lastName" name="lastName" autocomplete="family-name">
142+
</div>
143+
<div class="form-group">
144+
<label for="email">Email:</label>
145+
<input type="email" id="email" name="email" autocomplete="email" required>
146+
</div>
147+
<div class="form-group">
148+
<label for="company">Company:</label>
149+
<input type="text" id="company" name="company" autocomplete="organization">
150+
</div>
151+
<div class="form-group">
152+
<label for="jobrole">Job Role:</label>
153+
<input type="text" id="jobrole" name="jobrole" autocomplete="organization-title">
154+
</div>
155+
<div class="form-group">
156+
<label for="tshirtsize">T-Shirt Size:</label>
157+
<input type="text" id="tshirtsize" name="tshirtsize" autocomplete="tshirt-size">
158+
</div>
159+
<div class="form-group">
160+
<label for="comments">Comments:</label>
161+
<input type="text" id="comments" name="comments" autocomplete="comments" value="OCW DatabaseWorld 2024">
162+
</div>
163+
<div class="form-group">
164+
<input type="submit" value="Submit">
165+
</div>
166+
</form>
167+
</div>
168+
</body>
169+
</html>

java-ai/src/main/resources/templates/digitaldoubleupload.html

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
border-radius: 5px;
4646
box-sizing: border-box;
4747
}
48+
select {
49+
width: 100%;
50+
padding: 10px;
51+
margin: 5px 0 20px 0;
52+
border: 1px solid #ccc;
53+
border-radius: 5px;
54+
box-sizing: border-box;
55+
}
4856
input[type="submit"] {
4957
background-color: #007BFF;
5058
color: white;
@@ -70,17 +78,51 @@ <h1>Please provide image and/or video and some basic info...</h1>
7078
<form method="post" action="/digitaldoubles/uploadimageandvideo" enctype="multipart/form-data">
7179

7280
<label for="image">Select image:</label>
73-
<!-- <label for="image" class="custom-file-upload">-->
74-
<!-- Choose Image-->
75-
<!-- </label>-->
7681
<input type="file" id="image" name="image" accept="image/*" required>
7782

7883
<label for="video">Select video:</label>
79-
<!-- <label for="video" class="custom-file-upload">-->
80-
<!-- Choose Video-->
81-
<!-- </label>-->
8284
<input type="file" id="video" name="video" accept="video/*" required>
8385

86+
<!-- Dropdown for Animation Style -->
87+
<label for="animstyle">Select Animation Style:</label>
88+
<select id="animstyle" name="animstyle">
89+
<option value="style1">Style 1</option>
90+
<option value="style2">Style 2</option>
91+
<option value="style3">Style 3</option>
92+
<option value="style4">Style 4</option>
93+
<option value="style5">Style 5</option>
94+
<option value="style6">Style 6</option>
95+
<option value="style7">Style 7</option>
96+
<option value="style8">Style 8</option>
97+
<option value="style9">Style 9</option>
98+
<option value="style10">Style 10</option>
99+
<option value="style11">Style 11</option>
100+
<option value="style12">Style 12</option>
101+
<option value="style13">Style 13</option>
102+
<option value="style14">Style 14</option>
103+
<option value="style15">Style 15</option>
104+
<option value="style16">Style 16</option>
105+
<option value="style17">Style 17</option>
106+
<option value="style18">Style 18</option>
107+
<option value="style19">Style 19</option>
108+
<option value="style20">Style 20</option>
109+
<option value="style21">Style 21</option>
110+
<option value="style22">Style 22</option>
111+
<option value="style23">Style 23</option>
112+
<option value="style24">Style 24</option>
113+
<option value="style25">Style 25</option>
114+
<option value="style26">Style 26</option>
115+
<option value="style27">Style 27</option>
116+
<option value="style28">Style 28</option>
117+
<option value="style29">Style 29</option>
118+
<option value="style30">Style 30</option>
119+
<option value="style31">Style 31</option>
120+
<option value="style32">Style 32</option>
121+
<option value="style33">Style 33</option>
122+
<option value="style34">Style 34</option>
123+
<option value="style35">Style 35</option>
124+
</select>
125+
84126
<div class="form-group">
85127
<label for="firstName">First Name:</label>
86128
<input type="text" id="firstName" name="firstName" autocomplete="given-name">

0 commit comments

Comments
 (0)