cyzlucky / UE5-python-blender-chatgpt

🐍 Code to test Python Unreal Engine 5 capabilites, Blender & HoudiniFX scripts for testing, a twitter bot, reddit script and ChatGPT & other open-source text generation models scripts and utilities.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UE5-python

🐍 Let's test this Python-Unreal Engine 5 thing for Video Game Production Management!

Project Settings -> Plugins -> Python and enable developer mode.

chatBot

For running it on Windows or Android (Termux App) follow the section Manual Installation down on this post.

  • Install it on GNU/Linux (Easiest way)

sudo apt-get install -y git python3 build-essential portaudio19-dev

git clone https://github.com/AleixMT/Linux-Auto-Customizer

cd Linux-Auto-Customizer

git checkout chatGPT_feature

bash src/core/install.sh -v -o chatGPT

Get your openAI API key (Go to openai webpage to get yours)

Change 'your_API_key_value' to the one you got from openai webpage before running the next command:

echo "OPENAI_API_KEY=your_API_key_value" > ~/.customizer/bin/chatGPT/Content/Python/chatBot/.env

bash

That's it, now just type chatGPT in the console and magic happens.

Use 'exit' or 'quit' words to end the conversation.

chatGPT

You can use talkGPT (but not yet in Android) to talk to the console and the AI will respond using a custom voice too.

talkGPT

TODO (known bugs):

  • Voice to text recognizement & pytorch install seems not to work in Android (Termux)
  • real-time history for conversate.py and talk.py

Also you can generate code using the function codeGPT to generate code when commentaries are passed to it.

Example:

codeGPT "# Python3 # A code to store a list of dictionaries of fruits and vegetables"

A string can also be passed to chatGPT and talkGPT and it will only run that line. Put the text in between matching "" quotes.

chatGPT "Kant vs. Nietzsche. Give me a well formatted table containing relationships of similarity and opposite thoughts on the deepest issues of their careers and thoughts on philosophy topic, in a json format so I can import it to python. With that json file, tell me proportionally in what they agree in a percentage, and form that percentages, only show me one which resumes all the other percentages to I only have a total percentage of agreement they had overall they careers and explain to me why it's overall pertentage is what it is. Specify more information on the topics they disagree and show quotes of them to prove it"

talkGPT "Tell me any playing card"

chatBot manual installation

  • Install Python3 and Git

GNU/Linux:

sudo apt-get install -y python3 git

Termux (Android):

pkg install -y root-repo

pkg update -y

pkg upgrade -y

apt install -y git build-essential python3

  • Install Python dependencies

GNU/Linux:

pip3 install openai python-dotenv colorama

Windows:

pip install openai python-dotenv colorama

Termux (Android):

MATHLIB="m" pip3 install numpy openai

pip3 install wheel setuptools python-dotenv colorama

  • Clone git repository

git clone https://github.com/Axlfc/UE5-python

  • Navigate to Content/Python/chatBot repository directory

  • Log into openAI web page and get your API key.

  • Edit .env file from the chatBot repository folder and paste your API Key to set the variable OPENAI_API_KEY

  • Run conversate.py to begin to conversate with the AI locally on your terminal.

GNU/Linux & Termux (Android):

python3 conversate.py

Windows:

python conversate.py

  • Use exit or quit words to end the conversation.

If you want to run a simple command chat to run chatGPT in Windows Terminal, you can edit the C:\Users\Your_Username\Documents\WindowsPowershell\Microsoft.PowerShell_profile.ps1 file and add to it the following lines:

function chat_function { python C:\Users\Your_Username\Desktop\UE5-python\Content\Python\chatBot\conversate.py }

Set-Alias chat chat_function

If you also want that chat alias in GNU/Linux or Android, you can edit ~/.bash_aliases file and add:

chat() { python3 "~/UE5-python/Content/Python/chatBot/conversate.py" }

Now when you type chat in your Terminal it will start chatGPT.

talkGPT

If you want the AI to talk to you using a concrete voice, you should try running talk.py script which is used to make the AI process an audio file of their response, for the moment voice chat works only on Windows or GNU/Linux:

  • Install portaudio

GNU/Linux:

sudo apt-get install -y build-essential portaudio19-dev

  • Install the required Python dependencies and it should work:

GNU/Linux:

pip3 install git+https://github.com/openai/whisper.git jiwer gitpython gdown pathlib setuptools pyaudio soundfile pathlib numpy librosa SpeechRecognition langdetect googletrans==4.0.0-rc1

Windows:

pip install git+https://github.com/openai/whisper.git jiwer gitpython gdown pathlib setuptools pyaudio soundfile pathlib numpy librosa SpeechRecognition langdetect googletrans==4.0.0-rc1

Run talk.py to begin to talk with the AI locally on your terminal, the voice will process and then played.

GNU/Linux:

python3 talk.py

Windows:

python talk.py

Voice processing in talk.py script isn't able to mantain a conversation (almost) real time with the ChatGPT AI due to long audio processing time, but it is definitely possible.

codeGPT

If you only want the AI to generate code for you, use the script code.py and pass some commented code to it and it will reply creating code for you!

GNU/Linux & Termux (Android):

python3 code.py "# Python3 # A code to store a list of dictionaries of fruits and vegetables"

Windows:

python code.py "# Python3 # A code to store a list of dictionaries of fruits and vegetables"

There are more scripts inside the chatBot folder, you can check them out too.

twitterBot

Twitter stuff (API bot) (Scraping engine)

redditBot

Reddit stuff (API bot) (Scraping engine)

HoudiniFX

Test script with hython3.9.exe from Houdinit's folder. hython3.9.exe houdini.py

TODO:

  • Trick houdini to be able to import hou module correctly in houdini.py script using a regular python3 version trying to not rely on hython.

Blender

Nothing yet

About

🐍 Code to test Python Unreal Engine 5 capabilites, Blender & HoudiniFX scripts for testing, a twitter bot, reddit script and ChatGPT & other open-source text generation models scripts and utilities.


Languages

Language:Python 100.0%