Install python requirements:
pip3 install -r requirements.txt
Run the Server:
python3 flask_server.py
Add your OpenAI and Hume Keys in the .env.local file that you create:
OPENAI_API_KEY=your_key
HUME_API_KEY=your_key
NotOpenSSLWarning: urllib3 v2.0 only supports OpenSSL 1.1.1+
pip3 install urllib3==1.26.6
Do a POST request http://localhost:8081/characterInit
with the values you select.
Example characterInit POST
{
"name" : "YOUR_NAME",
"biome" : "easy",
"difficulty" : "medium",
}
Now run http://localhost:8081/getInitialResponse
Finally, execute http://localhost:8081/inputExpression
get request.
All responses are JSON.
IMPORTANT: When you finish running the program, you must do a GET request to http://localhost:8081/deleteAll to delete the databases and the images you have taken.
http://localhost:8081/getInitialResponse
Returns: {'gpt4_response': This is response …, “health”: 100, “food”: 95, “water”: 110}
http://localhost:8081/getCharValues
Returns: {“health”: 100, “food”: 110, “water”: 105}
Hardcoded to desert. It is recommended to use desert as of now.
http://localhost:8081/generateSprite
Returns: {“img_url”: http://link-to-generated-image.com}
Do a GET request whenever you want your computer to capture from the camera and this will return gpt4_response
, health
, food
, and water
values. Do this at most 3 times for demonstration purposes since the Hume API can crash out.
http://localhost:8081/inputExpression
Returns: {“gpt4_response”: This is response …, “health”: 100, “food”: 95, “water”: 110}
http://localhost:8081/deleteAll
Returns: {"Status”: 200}
http://localhost:8081/getStatsValues
Returns: N/A
http://localhost:8081/characterInit
“name”: Adrian Bao, “biome”: desert, “difficulty”: medium
Returns: Data inserted successfully
-
take_pic.py
creates an instance of picture if a face is detected via OpenCV. The camera will save the file under the namecaptured_image.jpg
. A new picture will be taken every time the user creates a new request - preferably every five seconds. -
run_hume.py
connects thecaptured_image.jpg
to the Hume API. The API will detect the top 6 emotions in that image and will rate them with an integer value that will then be used in theflask_server.py
class to either increase or decrease the values ofhealth
,water
,food
, etc. These stats can then be visualized in the user interface. -
dalle-img-generator.py
connects to the GPT-4 API, adds a prompt describing the image and generates an output of dimensions 1024x1024. The output creates a url pointing to the generated image. -
gpt4.py
connects to the GPT-4 API.