diff --git a/memberships/templates/memberships/humans.txt b/memberships/templates/memberships/humans.txt index 896df25b..1db0ac8a 100644 --- a/memberships/templates/memberships/humans.txt +++ b/memberships/templates/memberships/humans.txt @@ -8,6 +8,7 @@ Tristan Bentham -- Front End Developer Giulio Giunta -- Infrastructure Engineer Padawan Sam Winterhalder -- Developer + Ali Gunes -- Developer # THANKS diff --git a/memberships/user_avatar_component_ai/API_KEY.py b/memberships/user_avatar_component_ai/API_KEY.py new file mode 100644 index 00000000..74a52a01 --- /dev/null +++ b/memberships/user_avatar_component_ai/API_KEY.py @@ -0,0 +1,8 @@ +api_key = "" + +# Add openai api key +# DO NOT MAKE API KEY PUBLIC +""" This will incur charges (as of writing this the fee should be 1/5th of a penny per image), +It might be possible to get a non-profit grant from openai OR +use new members donations to subsidize the avatar +""" diff --git a/memberships/user_avatar_component_ai/img_avatar.png b/memberships/user_avatar_component_ai/img_avatar.png new file mode 100644 index 00000000..8fa748c6 Binary files /dev/null and b/memberships/user_avatar_component_ai/img_avatar.png differ diff --git a/memberships/user_avatar_component_ai/index.html b/memberships/user_avatar_component_ai/index.html new file mode 100644 index 00000000..a3573d01 --- /dev/null +++ b/memberships/user_avatar_component_ai/index.html @@ -0,0 +1,15 @@ + + + + Ai Avatar + + + +
+ Avatar +

Your Avatar

+
+
+
+ + \ No newline at end of file diff --git a/memberships/user_avatar_component_ai/main.py b/memberships/user_avatar_component_ai/main.py new file mode 100644 index 00000000..64cab2e5 --- /dev/null +++ b/memberships/user_avatar_component_ai/main.py @@ -0,0 +1,29 @@ +# pip install pillow +# pip install openai + +import openai +from API_KEY import api_key +import requests +from PIL import Image +from io import BytesIO + +openai.api_key = api_key + + +def avatar_gen(): + response = openai.Image.create( + prompt="the bust of a cool robot character from the shoulders up, facing forward", + n=1, + size="1024x1024", + ) + image_url = response["data"][0]["url"] + + # Download the image + img_data = requests.get(image_url).content + img = Image.open(BytesIO(img_data)) + + # Save the image as "img_avatar.png" + img.save("img_avatar.png", "PNG") + + +avatar_gen() diff --git a/memberships/user_avatar_component_ai/styles.css b/memberships/user_avatar_component_ai/styles.css new file mode 100644 index 00000000..23daa7e1 --- /dev/null +++ b/memberships/user_avatar_component_ai/styles.css @@ -0,0 +1,29 @@ +.card { + /* Add shadows to create the "card" effect */ + border-radius: 10px; + height: auto; + width: 300px; + box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2); + transition: 0.3s; +} + +/* On mouse-over, add a deeper shadow */ +.card:hover { + box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2); +} + +/* Add some padding inside the card container */ +.container { + padding: 2px 16px; +} + +#avatar { + /* Add styling for the avatar image */ + width: 100%; /* To ensure it fills the card */ +} + +.card-image { + width:100%; + border-top-left-radius: 10px; + border-top-right-radius: 10px; +} diff --git a/requirements.txt b/requirements.txt index 500fc558..5c3310dd 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ +openai==0.27.0 asgiref~=3.3 backports.functools-lru-cache>=1.6.4 beautifulsoup4==4.9.3