Project Title:
Team Details:
Karunya
Shukla(23SCSE1410153)
Anurag Jaiswal(23SCSE1410204)
Section:33
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
Avatar Generator: A Personalised Approach
to avatar creation in Stable Diffusion.
Agenda
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
•Problem Statement
•Data-Flow
•Technology used
•Conclusion
•Demo
•References
Problem Statement
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
• In today's digital world, people increasingly rely on avatars to represent
themselves in various online platforms.
However, most avatar generators offer limited customisation options, leading
to
generic and un-engaging representations.
• Our project aims to create an AI avatar generator that allows users to
generate personalised, diverse, and engaging avatars, enhancing their digital
identities and online experiences.
Data-FlowChart:
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
1. User
accesses
the AI
avatar
generator
platform.
4. User can re-
enter prompt
for more
customisatio
n
3. The platform's AI
processes the user's
selections and generates a
customised avatar based on
api from pre-trained model,
here SDXL.
5. Once satisfied, users can
download or share their
AI-generated avatar.
2. User Enter
prompt in the
prompt box
Technology Used
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
1.Machine Learning: Utilising pre-trained machine learning model i.e. Stable Diffusion to generate personalised avatars based
2.Google Colab Notebook: We have utilised free compute power of Tesla T4 GPU that comes free of cost upto 40 unit of comp
3.Programming Languages: Utilises Python and its various frameworks for development.
4.Libraries and Frameworks: Employ libraries and frameworks such as Hugging face , Xformer (for speeding up the infer
5.Flask and Tkinter framework for developing the UI to access the model.
Sample Source Code
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
import customtkinter as ctk # pip install customtkinter , tkinter ,os ,
openai
from PIL import Image, ImageTk
import requests, io
def generate():
openai.api_key = os.getenv("OPENAI_API_KEY")
user_prompt = prompt_entry.get("0.0", tkinter.END)
user_prompt += "in style: " + style_dropdown.get()
response = openai.Image.create(
prompt=user_prompt,
n=int(number_slider.get()),
size="512x512"
)
image_urls = []
for i in range(len(response['data'])):
image_urls.append(response['data'][i]['url'])
print(image_urls)
images = []
for url in image_urls:
response = requests.get(url)
image = Image.open(io.BytesIO(response.content))
photo_image = ImageTk.PhotoImage(image)
images.append(photo_image)
def update_image(index=0):
canvas.image = images[index]
canvas.create_image(0, 0, anchor="nw", image=images[index])
index = (index + 1) % len(images)
canvas.after(3000, update_image, index)
update_image()
root = ctk.CTk()
root.title("AI Image Generator")
ctk.set_appearance_mode("dark")
input_frame = ctk.CTkFrame(root)
input_frame.pack(side="left", expand=True, padx=20, pady=20)
prompt_label = ctk.CTkLabel(input_frame, text="Prompt")
prompt_label.grid(row=0, column=0, padx=10, pady=10)
prompt_entry = ctk.CTkTextbox(input_frame, height=10)
prompt_entry.grid(row=0, column=1, padx=10, pady=10)
style_label = ctk.CTkLabel(input_frame, text="Style")
style_label.grid(row=1, column=0, padx=10, pady=10)
style_dropdown = ctk.CTkComboBox(input_frame, values=["Realistic", "Cartoon", "3D Illustration",
"Flat Art"])
style_dropdown.grid(row=1, column=1, padx=10, pady=10)
generate_button = ctk.CTkButton(input_frame, text="Generate", command=generate)
generate_button.grid(row=3, column=0, columnspan=2, sticky="news", padx=10, pady=10)
canvas = tkinter.Canvas(root, width=512, height=512)
canvas.pack(side="left")
root.mainloop()
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
Prompt used:
A lovely pepe with his pepe gf in a romatic location , they
both on a date in openroof restaurant. Weather is
romantic with roses falling
. 3d and ar-16:9
Prompt used:
Closed-up 2d
avatar of a brown
Pepe of saharan
origin , wondering
in a gloomy state
of mind.
Bg: White
ar-16:9
First of the many batch of
training image being
uploaded to fine-tune our
SD model.
Some Avatar we generated in the test run:
Results
Conclusion
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
• The AI avatar generator project addresses the need for personalised and engaging avatars,
enhancing users' digital identities and online experiences.
• By leveraging machine learning algorithms, the platform provides a unique and innovative solu
• Future improvements may include real-time avatar generation, integration with popular platform
and advanced customisation options.
• The AI avatar generator has the potential to revolutionise the way users represent themselves
fostering a more personalised and engaging digital world.
Name of the School: School of Computer Science and Engineering
Course Code: E2UC201C Course Name: OOPS
Thank you.
References:
Most of the codebase is inspired from the inner documentation of the
https://github.com/codefirstio repo on deploying tkinter apps has been a
great help.

Object oriented programming introduction in python

  • 1.
    Project Title: Team Details: Karunya Shukla(23SCSE1410153) AnuragJaiswal(23SCSE1410204) Section:33 Name of the School: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS Avatar Generator: A Personalised Approach to avatar creation in Stable Diffusion.
  • 2.
    Agenda Name of theSchool: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS •Problem Statement •Data-Flow •Technology used •Conclusion •Demo •References
  • 3.
    Problem Statement Name ofthe School: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS • In today's digital world, people increasingly rely on avatars to represent themselves in various online platforms. However, most avatar generators offer limited customisation options, leading to generic and un-engaging representations. • Our project aims to create an AI avatar generator that allows users to generate personalised, diverse, and engaging avatars, enhancing their digital identities and online experiences.
  • 4.
    Data-FlowChart: Name of theSchool: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS 1. User accesses the AI avatar generator platform. 4. User can re- enter prompt for more customisatio n 3. The platform's AI processes the user's selections and generates a customised avatar based on api from pre-trained model, here SDXL. 5. Once satisfied, users can download or share their AI-generated avatar. 2. User Enter prompt in the prompt box
  • 5.
    Technology Used Name ofthe School: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS 1.Machine Learning: Utilising pre-trained machine learning model i.e. Stable Diffusion to generate personalised avatars based 2.Google Colab Notebook: We have utilised free compute power of Tesla T4 GPU that comes free of cost upto 40 unit of comp 3.Programming Languages: Utilises Python and its various frameworks for development. 4.Libraries and Frameworks: Employ libraries and frameworks such as Hugging face , Xformer (for speeding up the infer 5.Flask and Tkinter framework for developing the UI to access the model.
  • 6.
    Sample Source Code Nameof the School: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS import customtkinter as ctk # pip install customtkinter , tkinter ,os , openai from PIL import Image, ImageTk import requests, io def generate(): openai.api_key = os.getenv("OPENAI_API_KEY") user_prompt = prompt_entry.get("0.0", tkinter.END) user_prompt += "in style: " + style_dropdown.get() response = openai.Image.create( prompt=user_prompt, n=int(number_slider.get()), size="512x512" ) image_urls = [] for i in range(len(response['data'])): image_urls.append(response['data'][i]['url']) print(image_urls) images = [] for url in image_urls: response = requests.get(url) image = Image.open(io.BytesIO(response.content)) photo_image = ImageTk.PhotoImage(image) images.append(photo_image) def update_image(index=0): canvas.image = images[index] canvas.create_image(0, 0, anchor="nw", image=images[index]) index = (index + 1) % len(images) canvas.after(3000, update_image, index) update_image() root = ctk.CTk() root.title("AI Image Generator") ctk.set_appearance_mode("dark") input_frame = ctk.CTkFrame(root) input_frame.pack(side="left", expand=True, padx=20, pady=20) prompt_label = ctk.CTkLabel(input_frame, text="Prompt") prompt_label.grid(row=0, column=0, padx=10, pady=10) prompt_entry = ctk.CTkTextbox(input_frame, height=10) prompt_entry.grid(row=0, column=1, padx=10, pady=10) style_label = ctk.CTkLabel(input_frame, text="Style") style_label.grid(row=1, column=0, padx=10, pady=10) style_dropdown = ctk.CTkComboBox(input_frame, values=["Realistic", "Cartoon", "3D Illustration", "Flat Art"]) style_dropdown.grid(row=1, column=1, padx=10, pady=10) generate_button = ctk.CTkButton(input_frame, text="Generate", command=generate) generate_button.grid(row=3, column=0, columnspan=2, sticky="news", padx=10, pady=10) canvas = tkinter.Canvas(root, width=512, height=512) canvas.pack(side="left") root.mainloop()
  • 7.
    Name of theSchool: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS Prompt used: A lovely pepe with his pepe gf in a romatic location , they both on a date in openroof restaurant. Weather is romantic with roses falling . 3d and ar-16:9 Prompt used: Closed-up 2d avatar of a brown Pepe of saharan origin , wondering in a gloomy state of mind. Bg: White ar-16:9 First of the many batch of training image being uploaded to fine-tune our SD model. Some Avatar we generated in the test run: Results
  • 8.
    Conclusion Name of theSchool: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS • The AI avatar generator project addresses the need for personalised and engaging avatars, enhancing users' digital identities and online experiences. • By leveraging machine learning algorithms, the platform provides a unique and innovative solu • Future improvements may include real-time avatar generation, integration with popular platform and advanced customisation options. • The AI avatar generator has the potential to revolutionise the way users represent themselves fostering a more personalised and engaging digital world.
  • 9.
    Name of theSchool: School of Computer Science and Engineering Course Code: E2UC201C Course Name: OOPS Thank you. References: Most of the codebase is inspired from the inner documentation of the https://github.com/codefirstio repo on deploying tkinter apps has been a great help.