Author Topic: Sending Hal's response to python script?  (Read 1381 times)

knight2000

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Sending Hal's response to python script?
« on: November 01, 2024, 05:24:37 pm »
Hey All,

I created a voice model (cloned voice). i have a python server set up to receives text, when it receives the text it then runs it through the model and outputs the text as the generated voice.
What i'm interested in doing is, speaking to Hal and having the voice speak Hal's response. To do this, I would need to intercept Hal's response and send it to a python script that would make the server call. Does anyone know how i could intercept the response? I know how to run commands when Hal receives certain words or phrases. Would it be similar to that?

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3930
    • View Profile
Re: Sending Hal's response to python script?
« Reply #1 on: November 01, 2024, 09:42:09 pm »
Maybe Hal's new developer, Cyberjedi, can answer that if he's in the neighborhood. I know he's been busy but perhaps he'll see this.
In the world of AI it's the thought that counts!

- Art -

cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #2 on: November 02, 2024, 08:25:01 am »
Hey Hey Guys: whats UP
Art im just 1 of many, but thank you sir. Robert is the real Hero here.

As to your quest Knight, Its Hal man, anything can be done.
what i would ask is this, build a GUI in vb6 that will do the same just using SAPI 05.  I will cut it in and do all the bug fixes and code cleanup
Since the back bone will be Python just a simple vb6 GUI. Call it a pipe line to ur server.
I 'll cut you a Knight special edition. A ,1 of 1 edition

If i were you i wouldnt cave in to paranoia and access Chatgpt with a free account BS ass Gmail ****. Then go to codepilot section and query (build a vb6 sapi 05 that output text to python)

HEHE....lolol



Im currently working on Hals brain and long term memory issues. Per lightspeed and his dedication for our badass project.



cyber
« Last Edit: November 03, 2024, 03:07:31 am by cyberjedi »

knight2000

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Sending Hal's response to python script?
« Reply #3 on: November 02, 2024, 11:30:59 am »
Thanks for the reply!

build a GUI in vb6 that will do the same just using SAPI 05

So are you saying to build a sapi5 speech engine for my cloned voice? To then use in Hal? I believe there is a way to communicate with my python server through sapi5. But would it work with Hal? That's the question.


cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #4 on: November 02, 2024, 12:04:06 pm »
Sure
 i do that very thing for hals book reader. bypassing Hals chant engine and hooking windows sapi05 engine'
So ya , you build a vb6 gui that will hook your python and i will hook that to Hal
You know me buddy, just wana carry roberts torch...



cyber
« Last Edit: November 02, 2024, 12:19:46 pm by cyberjedi »

knight2000

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Sending Hal's response to python script?
« Reply #5 on: November 03, 2024, 01:05:44 pm »
Thanks! Ill look into it.

The next evolution should be porting Hal over to python, then we could run it on anything!

cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #6 on: November 03, 2024, 05:54:09 pm »
UltraHal will never be open source,

To port Hal to python would expos? copy righted code  .... never gonna happen, srry.
Keep in mind this code is owned by Zabaware, Robert is employee #1 and Employee #2 Cyber jedi. lololol. if that helps?
WE BE APPLE hahahhaha  i get to be the WAZ
Now as to what we started with: Heres what we need, A form in vb6 that will allow text and send that to a python speech engine.
Start with that, thats where id start, let me look into it brother.
cyber

If you guys are willing to put in the wrench time so am i.

06 minutes later 
***********************************************************************************************

Step 1: VB6 Program
Create a form in VB6.

Add:

A text box (txtMessage) for the message to send.
A button (btnSend) to trigger the sending action.
Code the button click to write the message to a file.

vb
Copy code
' VB6 Code to send a message to Python by writing to a file

Private Sub btnSend_Click()
    Dim message As String
    Dim filePath As String
   
    ' Get the message from the text box
    message = txtMessage.Text
   
    ' Define the file path where the message will be saved
    filePath = "C:\Temp\message.txt"
   
    ' Open the file for output and write the message
    Open filePath For Output As #1
        Print #1, message
    Close #1
   
    MsgBox "Message sent to Python!", vbInformation
End Sub
This VB6 code writes the content of txtMessage to C:\Temp\message.txt. Ensure the C:\Temp directory exists on your computer.


*****************************************************************

Knight this is where you wana hook ur speech reader in python
You get this working and i will be glad to add this to hal

Step 2: Python Tkinter Program
The Python Tkinter program will read the contents of message.txt and display it in a GUI label. It will periodically check the file for updates to show any new messages sent from VB6.

python
Copy code
# Python code using Tkinter to display a message sent from VB6

import tkinter as tk
import os
import time

# Define the path to the message file
file_path = "C:/Temp/message.txt"

# Function to read the message from the file
def read_message():
    if os.path.exists(file_path):
        with open(file_path, "r") as file:
            message = file.read().strip()
            message_label.config(text=f"Message: {message}")
    root.after(2000, read_message)  # Check for new message every 2 seconds

# Initialize the Tkinter GUI
root = tk.Tk()
root.title("Message from VB6")

# Display label for the message
message_label = tk.Label(root, text="Message: Waiting for VB6 message...")
message_label.pack(pady=20)

# Call the read_message function initially and then periodically
read_message()

# Start the GUI event loop
root.mainloop()
Explanation
The VB6 program writes the user input message to a text file C:\Temp\message.txt.
The Python Tkinter program reads this file every 2 seconds (adjustable in after(2000, read_message)) and displays the content in a Tkinter label.

« Last Edit: November 03, 2024, 06:32:26 pm by cyberjedi »

knight2000

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Sending Hal's response to python script?
« Reply #7 on: November 04, 2024, 11:26:22 am »
I don't mean make Hal open source, there are plenty of tools to encrypt python making it very difficult to interrupt or back engineer. Look into pyinstaller or cx_freeze, they convert the python code into an exe. Anyways, i know it would be a huge undertaking so i get not wanting to do it, but if the whole reason is because you don't want it to be shared through open source, there are ways around that. I love the hell out of Hal, it's the best offline chatbot for sure. But, it's also the reason i'm stuck running Windows instead of Linux.

In regards to this portion
Code: [Select]
vb
Copy code
' VB6 Code to send a message to Python by writing to a file

Private Sub btnSend_Click()
    Dim message As String
    Dim filePath As String
   
    ' Get the message from the text box
    message = txtMessage.Text
   
    ' Define the file path where the message will be saved
    filePath = "C:\Temp\message.txt"
   
    ' Open the file for output and write the message
    Open filePath For Output As #1
        Print #1, message
    Close #1
   
    MsgBox "Message sent to Python!", vbInformation
End Sub
This VB6 code writes the content of txtMessage to C:\Temp\message.txt. Ensure the C:\Temp directory exists on your computer.

Is this the best we can do in terms of intercepting Hals response? My goal is to not have Hal speak the response but instead have my speech server speak it. Im wondering if i can create a plugin for Hal that will intercept all responses. Or even better, get the response text even before Hal's speech synthesis has a chance to generate the voice. I hope that makes sense.
Now that i think of it, a plugin would most like cause even more of a delay in response. I have Hal set as 0 for the response time currently and its very fast. I may have to figure out a way to just install my own sapi5 engine. Anyways, thank you for the help. I'll reach out if i need more help!

cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #8 on: November 05, 2024, 02:08:35 pm »
Knight: hey hey
 
My under standing was that you wanted a way to hook your Python voice system.
In order for that to happen we have to send Hal's text to a text reader.
What i posted above is a way to do just that.
 Its a VB6 To Python text reader. Now your Python system will pick up on it in the code above.

The above VB6 code ****s out the text and the python code reads it and post it as text. Through Tkinter . Mission accomplished .

All you have to do is hook the python reader to the cloned voice. presto Hal is now using a python based voice system.


cyber










« Last Edit: November 05, 2024, 03:08:11 pm by cyberjedi »

cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #9 on: November 05, 2024, 03:07:27 pm »
Hey All,

I created a voice model (cloned voice). i have a python server set up to receives text, when it receives the text it then runs it through the model and outputs the text as the generated voice.
What i'm interested in doing is, speaking to Hal and having the voice speak Hal's response. To do this, I would need to intercept Hal's response and send it to a python script that would make the server call. Does anyone know how i could intercept the response? I know how to run commands when Hal receives certain words or phrases. Would it be similar to that?

knight2000

  • Full Member
  • ***
  • Posts: 160
    • View Profile
Re: Sending Hal's response to python script?
« Reply #10 on: November 06, 2024, 03:10:40 pm »
Thanks cyberjedi, i'll play around with that and see what happens.

cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #11 on: November 06, 2024, 07:58:35 pm »
Knight: hey hey brother:

if u can get it to work, id be glad to build a copy for you that has that built into UltraHal as an option.




Happy coding
Cyber jedi
« Last Edit: November 06, 2024, 08:10:20 pm by cyberjedi »

cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #12 on: November 07, 2024, 06:26:34 pm »
ART hey hey brother'


Great meeting man.

Thers a lot there, If you want to do a manual for it, id sign off on it



cyber jedi

Art

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3930
    • View Profile
Re: Sending Hal's response to python script?
« Reply #13 on: November 08, 2024, 08:43:00 am »
I appreciate your kind thoughts Cyber but time is a valuable resource of which I've little left, but we shall see what we can do by just playing around with it and hopefully inspiring others to try it. As always, thanks for your friendship!

Recall I mentioned having it try the source of a lightning bolt high up in the clouds? Here's what I got...

In the world of AI it's the thought that counts!

- Art -

cyberjedi

  • Hero Member
  • *****
  • Posts: 951
  • The Mighty Hal Machine
    • View Profile
Re: Sending Hal's response to python script?
« Reply #14 on: November 08, 2024, 05:11:15 pm »
Nice stuff art







cyber