Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Apikey.py
39 changes: 32 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,43 @@

## README.md must consist of the following information:

#### Team Name -
#### Problem Statement -
#### Team Leader Email -
#### Team Name - Team Titans
#### Problem Statement - Knee OsteoArtheritis AI Report WebApp
#### Team Leader Email - [email protected]

## A Brief of the Prototype:
This section must include UML Diagrams and prototype description
Osteoarthritis is a joint disease impacting millions worldwide
WHO is 2019 said that there are 528 million people worldwide living.
In India, about 150 million people have osteoarthritis,while 32.5 million in United states suffer from it.
They go through a lot of pain like Joint pain, morning stiffness, pain during movement, pain at rest

As Osteoarthritis can you detected through X-Rays it can be also caused due to many other factors.
The combination of X-rays and related factors such as obesity, age, height, bone density can help us detect
Product Solution (1-3 Slides)
What the machine does it takes the X-ray input from the user and puts it through the model after that the model categories the X-ray as the severity of the patient
After the process id done it combines it with other factors like the weight, age, height, bone density which gives us end results also by using OpenAI we created a prompt where when user puts all this info it gives them suggestions about the Osteoarthritis.
Differentiations (USPs)
Considering various factors that can also lead to Osteoarthritis and create accurate results.
Higher accurate results
Prompt where you can get tailored solution according to the severity of Osteoarthritis

User Interface => User Uploads the X-Rays => User gets seventy grading => User is asked with more details such as gender, age , weights => all parameters along with it gets passed => a report is generated



## Tech Stack:
List Down all technologies used to Build the prototype
TensorFLow
Gradio
OpenAI

## Step-by-Step Code Execution Instructions:
This Section must contain a set of instructions required to clone and run the prototype so that it can be tested and deeply analyzed
Run the Model step by step no other thing needed

## What I Learned:
Write about the biggest learning you had while developing the prototype
There are many people who suffer with this and with this we can help people out also with medical we need to consider lots of aspects and overall view

## Link to download the model:
https://drive.google.com/file/d/1t6XblfNhaDe4RskXoY_Apha6csvVReno/view?usp=sharing

## Demo Video of the System
https://drive.google.com/file/d/1sm1Q5RLMmI3C8pt_nhR8-xKNEDvmaEba/view?usp=drive_link
70 changes: 70 additions & 0 deletions model.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import numpy as np
import pandas as pd
import cv2 as cv
import matplotlib.pyplot as plt
import os
import pickle
import tensorflow as tf
from tensorflow.keras.layers import Input, Conv2D, MaxPooling2D, BatchNormalization
from tensorflow.keras.preprocessing.image import ImageDataGenerator
from tensorflow.keras.callbacks import ModelCheckpoint, EarlyStopping, ReduceLROnPlateau
from keras.models import Model
from sklearn.preprocessing import LabelBinarizer
save_model = tf.keras.models.load_model("Best_DenseNet201.h5",compile=False)


from PIL import Image
import gradio as gr
import numpy as np
from skimage import transform
from tensorflow.keras.utils import load_img, img_to_array
from keras.preprocessing.image import ImageDataGenerator
from keras.applications.vgg16 import preprocess_input

def load(filename):
my_image = load_img(filename, target_size=(224, 224))

#preprocess the image
my_image = img_to_array(my_image)
my_image = my_image.reshape((1, my_image.shape[0], my_image.shape[1], my_image.shape[2]))
my_image = preprocess_input(my_image)

#make the prediction
prediction = save_model.predict(my_image)
print(prediction)
prediction = tf.argmax(tf.nn.softmax(prediction), 1)
return "Serverity grading:- " + str(int(tf.get_static_value(prediction).item()))


import openai
from Apikey import OPENAI_API_KEY

def noob_wrapper(gender, obesity, severity_grading_score, age):

openai.api_key = OPENAI_API_KEY

prompt = "You are a arthritis doctor and your patient has osteoarthritis."

messages = [ {"role": "system", "content":
prompt} ]
while True:
message = f"Severity grade my osteoarthritis is {severity_grading_score} and his gender is {gender} and his age is {age} and his obesity is {obesity}. Renerate a report on this."
if message:
messages.append(
{"role": "user", "content": message},
)
chat = openai.ChatCompletion.create(
model="gpt-3.5-turbo", messages=messages
)
reply = chat.choices[0].message.content
print(f"ChatGPT: {reply}")
return reply



demo = gr.Interface(fn=noob_wrapper, inputs=[gr.Radio(["Male", "Female", "Undefined"], label="Gender"), gr.Radio(["Yes", "No"], label="Obesity"),gr.Textbox(placeholder="Enter Severity Grading Score"),gr.Textbox(placeholder="Enter Your Age")], outputs="text")
gradio = gr.Interface(fn=load,inputs=gr.Image(type="filepath"),outputs=gr.Label())

demo2 = gr.TabbedInterface([gradio, demo], ["Severity Grading", "Report Generation"])

demo2.launch()