give me detailed content for every

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 7

give me detailed content for every chapter and subheading for this report , you can

refer the project code i gave at end too :

Report for PD Tracker - AI Powered Parkinson's Disease Tracker

Chapter 1: Introduction
Background Information
Purpose of the Project
Project Scope

Chapter 2: Project Setup


Tools and Technologies Used
Dependencies and Libraries
Setting Up the Environment

Chapter 3: Project Structure


Class Overview
Module Breakdown
File Structure

Chapter 4: User Interface Design


Navigation Layout
Home Frame Features
Image Analysis Frame
Spiral Drawing Frame

Chapter 5: API Integration


API Key Setup
Image Analysis API Call
Handling API Responses

Chapter 6: Image Processing


Image Upload Functionality
Image Encoding Process
Analyzing Uploaded Images
Saving Drawings as Images

Chapter 7: Data Visualization


Canvas Drawing Features
Real-time Drawing Updates
Saving and Exporting Drawings

Chapter 8: User Interactions


Button Events and Functions
Opening External Links
Appearance Mode Selection

Chapter 9: Testing and Validation


Unit Testing Approach
Functional Testing Scenarios
Results and Validation

Chapter 10: Deployment


Deployment Strategy
Hosting Considerations
Deployment Steps

Chapter 11: Future Enhancements


Feature Expansion Possibilities
AI Algorithm Improvements
User Experience Enhancements

Chapter 12: Challenges and Solutions


Development Challenges Faced
Solutions Implemented
Lessons Learned

Chapter 13: Conclusion


Project Summary
Key Achievements
Final Thoughts

the project code:

import customtkinter
import os
from PIL import Image
import requests
from tkinter import filedialog, messagebox
import json
import base64
from tkinter import Canvas, Button
from PIL import ImageGrab
import webbrowser

class App(customtkinter.CTk):
def __init__(self):
super().__init__()

self.title("PD Tracker - AI Powered Parkinson's Disease Tracker using


Spiral Drawings")
self.geometry("800x600")

# set grid layout 1x2


self.grid_rowconfigure(0, weight=1)
self.grid_columnconfigure(1, weight=1)

self.api_key = "sk-proj-YQrUlgsCvV8t96c32aXHT3BlbkFJAmnsTA244jgXgxPehWXJ"

# load images with light and dark mode image


image_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"test_images")
self.logo_image =
customtkinter.CTkImage(Image.open(os.path.join(image_path,
"CustomTkinter_logo_single.png")), size=(26, 26))
self.large_test_image =
customtkinter.CTkImage(Image.open(os.path.join(image_path,
"large_test_image.png")), size=(500, 150))
self.image_icon_image =
customtkinter.CTkImage(Image.open(os.path.join(image_path,
"image_icon_light.png")), size=(20, 20))
self.home_image =
customtkinter.CTkImage(light_image=Image.open(os.path.join(image_path,
"home_dark.png")),

dark_image=Image.open(os.path.join(image_path, "home_light.png")), size=(20, 20))


self.chat_image =
customtkinter.CTkImage(light_image=Image.open(os.path.join(image_path,
"chat_dark.png")),

dark_image=Image.open(os.path.join(image_path, "chat_light.png")), size=(20, 20))


self.add_user_image =
customtkinter.CTkImage(light_image=Image.open(os.path.join(image_path,
"add_user_dark.png")),

dark_image=Image.open(os.path.join(image_path, "add_user_light.png")), size=(20,


20))

# create navigation frame


self.navigation_frame = customtkinter.CTkFrame(self, corner_radius=0)
self.navigation_frame.grid(row=0, column=0, sticky="nsew")
self.navigation_frame.grid_rowconfigure(4, weight=1)

self.navigation_frame_label = customtkinter.CTkLabel(self.navigation_frame,
text=" PD Tracker", image=self.logo_image,
compound="left",
font=customtkinter.CTkFont(size=15, weight="bold"))
self.navigation_frame_label.grid(row=0, column=0, padx=20, pady=20)

self.home_button = customtkinter.CTkButton(self.navigation_frame,
corner_radius=0, height=40, border_spacing=10, text="Links",
fg_color="transparent",
text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"),
image=self.home_image,
anchor="w", command=self.home_button_event)
self.home_button.grid(row=1, column=0, sticky="ew")

self.frame_2_button = customtkinter.CTkButton(self.navigation_frame,
corner_radius=0, height=40, border_spacing=10, text="Image Analysis",
fg_color="transparent",
text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"),
image=self.chat_image,
anchor="w", command=self.frame_2_button_event)
self.frame_2_button.grid(row=2, column=0, sticky="ew")

self.frame_3_button = customtkinter.CTkButton(self.navigation_frame,
corner_radius=0, height=40, border_spacing=10, text="Spiral Drawing",
fg_color="transparent",
text_color=("gray10", "gray90"), hover_color=("gray70", "gray30"),
image=self.add_user_image,
anchor="w", command=self.frame_3_button_event)
self.frame_3_button.grid(row=3, column=0, sticky="ew")

self.appearance_mode_menu =
customtkinter.CTkOptionMenu(self.navigation_frame, values=["Light", "Dark",
"System"],

command=self.change_appearance_mode_event)
self.appearance_mode_menu.grid(row=6, column=0, padx=20, pady=20,
sticky="s")

# create home frame


self.home_frame = customtkinter.CTkFrame(self, corner_radius=0,
fg_color="transparent")
self.home_frame.grid_columnconfigure(0, weight=1)
self.home_frame_large_image_label = customtkinter.CTkLabel(self.home_frame,
text="", image=self.large_test_image)
self.home_frame_large_image_label.grid(row=0, column=0, padx=20, pady=10)

self.home_frame_button_1 = customtkinter.CTkButton(self.home_frame,
text="Information", command=self.open_link_1)
self.home_frame_button_1.grid(row=1, column=0, padx=20, pady=10)
self.home_frame_button_2 = customtkinter.CTkButton(self.home_frame,
text="Inspiration", command=self.open_link_2)
self.home_frame_button_2.grid(row=2, column=0, padx=20, pady=10)
self.home_frame_button_3 = customtkinter.CTkButton(self.home_frame,
text="Ideation Paper", command=self.open_link_3)
self.home_frame_button_3.grid(row=3, column=0, padx=20, pady=10)
self.home_frame_button_4 = customtkinter.CTkButton(self.home_frame,
text="Wikipedia", command=self.open_link_4)
self.home_frame_button_4.grid(row=4, column=0, padx=20, pady=10)

# create second frame


self.second_frame = customtkinter.CTkFrame(self, corner_radius=0,
fg_color="transparent")
# Upload Image button
self.upload_image_button = customtkinter.CTkButton(self.second_frame,
text="Upload Image", command=self.upload_image)
self.upload_image_button.grid(row=0, column=0, padx=20, pady=10)

# Analyze Image button


self.analyze_image_button = customtkinter.CTkButton(self.second_frame,
text="Analyze Image", command=self.analyze_image)
self.analyze_image_button.grid(row=1, column=0, padx=20, pady=10)

# Text field for displaying results


self.result_text_field = customtkinter.CTkTextbox(self.second_frame,
height=200, width=400, wrap="word")
self.result_text_field.grid(row=2, column=0, padx=100, pady=100)

self.uploaded_image_path = None

# create third frame


self.third_frame = customtkinter.CTkFrame(self, corner_radius=0,
fg_color="transparent")

# Create a canvas for drawing spiral image


self.canvas = Canvas(self.third_frame, bg='white', width=500, height=300)
self.canvas.grid(row=0, column=0, padx=100, pady=20)

self.canvas.bind('<B1-Motion>', self.paint)

# Create a "Save Drawing" button


self.save_button = customtkinter.CTkButton(self.third_frame, text="Save
Drawing", command=self.save_drawing)
self.save_button.grid(row=1, column=0, padx=20, pady=10)

self.last_draw = None

# select default frame


self.select_frame_by_name("home")

def select_frame_by_name(self, name):


# set button color for selected button
self.home_button.configure(fg_color=("gray75", "gray25") if name == "home"
else "transparent")
self.frame_2_button.configure(fg_color=("gray75", "gray25") if name ==
"frame_2" else "transparent")
self.frame_3_button.configure(fg_color=("gray75", "gray25") if name ==
"frame_3" else "transparent")

# show selected frame


if name == "home":
self.home_frame.grid(row=0, column=1, sticky="nsew")
else:
self.home_frame.grid_forget()
if name == "frame_2":
self.second_frame.grid(row=0, column=1, sticky="nsew")
else:
self.second_frame.grid_forget()
if name == "frame_3":
self.third_frame.grid(row=0, column=1, sticky="nsew")
else:
self.third_frame.grid_forget()

def home_button_event(self):
self.select_frame_by_name("home")

def frame_2_button_event(self):
self.select_frame_by_name("frame_2")

def frame_3_button_event(self):
self.select_frame_by_name("frame_3")

def change_appearance_mode_event(self, new_appearance_mode):


customtkinter.set_appearance_mode(new_appearance_mode)

def upload_image(self):
file_types = [("Image Files", "*.png;*.jpg;*.jpeg")]
self.image_path = filedialog.askopenfilename(filetypes=file_types)
if self.image_path:
# Use self.image_path instead of file_path for clarity and to fix the
undefined variable error
self.result_text_field.insert("end", f"Loaded image: {self.image_path}\
n")
else:
self.result_text_field.insert("end", "No Image Uploaded\n")

# Function to encode the image


def encode_image(self):
with open(self.image_path, "rb") as image_file:
return base64.b64encode(image_file.read()).decode('utf-8')

def analyze_image(self):
if not self.image_path:
self.result_text_field.insert("end", "Please Upload an Image First\n")
return

base64_image = self.encode_image()

headers = {
"Authorization": f"Bearer {self.api_key}",
"Content-Type": "application/json"
}

payload = {
"model": "gpt-4-turbo",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Analyze the hand-drawn spiral image and
provide a detailed description of any characteristics that may suggest Parkinson's
disease tremors."
},
{
"type": "image_url",
"image_url": {
"url": f"data:image/jpeg;base64,{base64_image}"
}
}
]
}
],
"max_tokens": 300
}

response = requests.post("https://api.openai.com/v1/chat/completions",
headers=headers, json=payload)

# Clear the result text field before inserting new content


self.result_text_field.delete("1.0", "end")

if response.status_code == 200:
result_txt = response.json()['choices'][0]['message']['content']
# Insert the analysis result into the text field
self.result_text_field.insert("end", str(result_txt) + "\n")
else:
self.result_text_field.insert("end", f"Failed to analyze the image.
Error: {response.text}\n")

def paint(self, event):


paint_color = 'black' # Set the paint color
if self.last_draw:
self.canvas.create_line(self.last_draw[0], self.last_draw[1], event.x,
event.y, fill=paint_color, width=3)
self.last_draw = (event.x, event.y)

def save_drawing(self):
x0 = self.canvas.winfo_rootx() + self.canvas.winfo_x()
y0 = self.canvas.winfo_rooty() + self.canvas.winfo_y()
x1 = x0 + self.canvas.winfo_width()
y1 = y0 + self.canvas.winfo_height()

# Ask the user for the file save location


file_path = filedialog.asksaveasfilename(defaultextension=".png",
filetypes=[("PNG files", "*.png")])

if file_path:
# Grab the contents of the canvas and save as a PNG file at the chosen
location
ImageGrab.grab(bbox=(x0, y0, x1, y1)).save(file_path)
messagebox.showinfo("Save Drawing", "Drawing saved successfully!")

def open_link_1(self):
webbrowser.open("https://medium.com/ai-techsystems/parkinsons-disease-
detection-using-spiral-drawings-and-cnn-b82de9f3ed73")

# Function to open link 2


def open_link_2(self):

webbrowser.open("https://drive.google.com/file/d/1chY19lL1cfdyw2H3kRXn5ywLuzCelGni/
view?usp=drivesdk")

# Function to open link 3


def open_link_3(self):

webbrowser.open("https://drive.google.com/file/d/1caCLyRjK21HYJzEXnILLbLxNW5aIyD87/
view?usp=drivesdk")

# Function to open link 4


def open_link_4(self):
webbrowser.open("https://en.wikipedia.org/wiki/Parkinson%27s_disease")

if __name__ == "__main__":
app = App()
app.mainloop()

You might also like