Object oriented programming introduction in python

HOTLOOKYourstylepart 8 views 9 slides Jun 02, 2024
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

Oops project ppt.


Slide Content

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 User accesses the AI avatar generator platform. 4. User can re-enter prompt for more customisation 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 on user preferences. (SD1.5 is 7-billion parameter text-to-image open source model by StabilityAI) 2.Google Colab Notebook: We have utilised free compute power of Tesla T4 GPU that comes free of cost upto 40 unit of computing power (that's about 12hour of free training). 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 inference ). 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 solution for avatar customisation. Future improvements may include real-time avatar generation, integration with popular platforms, and advanced customisation options. The AI avatar generator has the potential to revolutionise the way users represent themselves online, 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 StableDiffusion’s Hugging-Face repository and Gradio’s developer handbook. https://github.com/codefirstio repo on deploying tkinter apps has been a great help.