Skip to content

Commit 1307a22

Browse files
committed
speech selectai variations
1 parent 53ddfbf commit 1307a22

File tree

9 files changed

+1678
-1
lines changed

9 files changed

+1678
-1
lines changed

interactive-ai-holograms/react-client/react-client/src/App.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,10 @@ function App() {
268268
<div className="App">
269269
<div>
270270
<h3>Interactive AI Holograms</h3>
271+
272+
<img src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGTacVCbweHP27h_x6f7PwRaazX0esJQtjnQXNep0ZpkK0JIqFC5bLfRWPknr3l9r9HoN3xV3nx072HrgxnVThOGFu-SOU145aJUCvQNNmKWoJc6z6Y8ad1PxXuahg-I0AMkcnPD77_tXze6-ZAMJO_Av4j0QhpG3mKrksKz3oAXI6m3HRjbjlCH7YTws/s959/Oracle%20Database%2023ai%20Now%20Available%20in%20Cloud.png" width="300" alt="Oracle Database 23ai" />
273+
274+
<br />
271275
<h5>Click 'Start session' and ask DeeBee/DB a question. </h5>
272276
<button onClick={toggleQuestionsVisibility}>
273277
{isQuestionsVisible ? 'Hide Examples' : 'Show Examples'}
@@ -281,6 +285,8 @@ function App() {
281285
<li>'What is the best video game?'</li>
282286
<li>'What is the best video game? Use Database'</li>
283287
<li>'What is Oracle for Startups? Use Database'</li>
288+
<li>'What is the latest version of the Oracle Database?'</li>
289+
<li>'What is the latest version of the Oracle Database? Use RAG'</li>
284290
</ul>
285291
</div>
286292
)}
@@ -306,7 +312,7 @@ function App() {
306312
placeholder="Enter your question"
307313
/>
308314
<button onClick={() => handleCallSelectAI(textFieldValue)}>Call Select AI</button>
309-
<br /><button onClick={mirrorMe}>Switch To "Mirror Me"</button>
315+
{/* <br /><button onClick={mirrorMe}>Switch To "Mirror Me"</button> */}
310316
</span>
311317

312318
</div>
4.54 KB
Loading
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import requests
2+
import time
3+
import os
4+
5+
# Base URL for the REST API (ensure that this is correct)
6+
BASE_URL = "http://localhost:8011/A2F"
7+
8+
# Path to the audio file you want to load
9+
audio_file_path = r"C:\Users\paulp\AppData\Local\ov\pkg\deps\b9070d65cb1908ec472cf47bc29f8126\exts\omni.audio2face.player_deps\deps\audio2face-data\tracks\output.wav"
10+
11+
# Function to load the audio file
12+
def load_audio_file():
13+
url = f"{BASE_URL}/USD/Load"
14+
data = {
15+
"file_path": audio_file_path
16+
}
17+
response = requests.post(url, json=data)
18+
if response.status_code == 200:
19+
print("Audio file loaded successfully!")
20+
else:
21+
print(f"Failed to load audio file: {response.status_code}")
22+
23+
# Function to play the audio
24+
def play_audio():
25+
url = f"{BASE_URL}/USD/Play"
26+
response = requests.post(url)
27+
if response.status_code == 200:
28+
print("Audio started playing!")
29+
else:
30+
print(f"Failed to play audio: {response.status_code}")
31+
32+
# Function to stop the audio
33+
def stop_audio():
34+
url = f"{BASE_URL}/USD/Stop"
35+
response = requests.post(url)
36+
if response.status_code == 200:
37+
print("Audio stopped successfully!")
38+
else:
39+
print(f"Failed to stop audio: {response.status_code}")
40+
41+
# Monitor the audio file and reload it when updated
42+
last_modified_time = None
43+
44+
def monitor_audio_file():
45+
global last_modified_time
46+
47+
while True:
48+
# Check the last modified time of the audio file
49+
current_modified_time = os.path.getmtime(audio_file_path)
50+
51+
# If the file has been modified, reload and play it
52+
if last_modified_time is None or current_modified_time > last_modified_time:
53+
stop_audio() # Stop any existing audio playback
54+
load_audio_file() # Load the updated audio file
55+
play_audio() # Play the audio automatically
56+
last_modified_time = current_modified_time
57+
58+
# Wait 5 seconds before checking again
59+
time.sleep(5)
60+
61+
# Start monitoring the audio file for changes
62+
monitor_audio_file()

0 commit comments

Comments
 (0)