Fracture_Bot / app.py
nayyabzahra148's picture
Update app.py
fb24a51 verified
import gradio as gr
from transformers import GPT2Tokenizer, GPT2LMHeadModel
import torch
# Step 1: Load the model and tokenizer from Hugging Face
repo_id = "nayyabzahra148/fracture_bot" # Replace with your Hugging Face repo ID
model = GPT2LMHeadModel.from_pretrained(repo_id)
tokenizer = GPT2Tokenizer.from_pretrained(repo_id)
# Step 2: Set the model to evaluation mode
model.eval()
# Step 3: Define the dataset for filtering
qa_data = [
("What is a greenstick fracture?", "A greenstick fracture is an incomplete fracture where the bone bends and cracks, rather than breaking completely into separate pieces. It is most common in children because their bones are softer and more flexible than adults."),
("What medications are used for pain relief in a greenstick fracture?", "Over-the-counter pain relievers like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Prescription painkillers may be used in severe cases."),
("How is a greenstick fracture treated?", "Treatment typically involves immobilization with a plaster cast or splint for 4–6 weeks. In cases of significant bending, the doctor may manually straighten the bone before applying the cast. Surgery is rare but may be needed in severe cases."),
("What is a transverse fracture?", "A transverse fracture is a type of bone fracture where the break occurs at a right angle (perpendicular) to the bone's axis, often caused by a direct blow or significant force."),
("What medications are used for pain management in a transverse fracture?", "Over-the-counter painkillers like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a transverse fracture treated?", "Treatment depends on the severity and location of the fracture. Minor fractures may be treated with a plaster cast or splint for 6–8 weeks. Severe fractures may require surgical realignment (ORIF) or external fixation."),
("What is an oblique fracture?", "An oblique fracture is a type of bone fracture characterized by a diagonal break across the bone, typically caused by a sharp, angled force such as a fall or direct blow."),
("What medications are used for pain relief in an oblique fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers may be prescribed in severe cases."),
("How is an oblique fracture treated?", "Treatment includes immobilization with a plaster cast or splint for 6–8 weeks. Severe or displaced fractures may require surgical realignment (ORIF) or external fixation. Physiotherapy is essential post-healing."),
("What is a comminuted fracture?", "A comminuted fracture occurs when a bone is broken into three or more pieces, often caused by high-impact trauma such as a car accident or severe fall."),
("What medications are used for pain management in a comminuted fracture?", "Over-the-counter painkillers like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a comminuted fracture treated?", "Treatment typically involves surgery (ORIF) to stabilize the bone fragments with metal plates, screws, or rods. External fixation or bone grafting may also be used. Physiotherapy is crucial post-healing."),
("What is a spiral fracture?", "A spiral fracture is a type of bone fracture where the bone breaks in a spiral pattern, usually caused by a twisting or rotational force, often seen in sports injuries or accidents."),
("What medications are used for pain relief in a spiral fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers may be prescribed in severe cases."),
("How is a spiral fracture treated?", "Treatment includes immobilization with a plaster cast or splint for 6–8 weeks. Severe or displaced fractures may require surgical realignment (ORIF) or external fixation. Physiotherapy is essential post-healing."),
("What is a compression fracture?", "A compression fracture occurs when a bone, typically in the spine (vertebrae), is compressed or crushed due to excessive pressure, often associated with osteoporosis, trauma, or metastatic cancer."),
("What medications are used for pain management in a compression fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be needed for severe pain."),
("How is a compression fracture treated?", "Treatment includes rest, pain relief, and bracing for minor fractures. Severe cases may require surgery (vertebroplasty or kyphoplasty). Physiotherapy is essential for restoring mobility and strength."),
("What is a segmental fracture?", "A segmental fracture occurs when the same bone is fractured in two or more separate places, leaving at least one bone fragment isolated between the breaks, typically caused by high-energy trauma."),
("What medications are used for pain relief in a segmental fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a segmental fracture treated?", "Treatment typically involves surgery (ORIF) to stabilize the bone fragments with metal plates, screws, or rods. External fixation or bone grafting may also be used. Physiotherapy is crucial post-healing."),
("What is an avulsion fracture?", "An avulsion fracture occurs when a small piece of bone is torn away from the main bone due to a sudden, strong pull by a ligament or tendon, often associated with sports injuries."),
("What medications are used for pain relief in an avulsion fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an avulsion fracture treated?", "Treatment includes immobilization with a splint or cast for 4–6 weeks. Severe cases may require surgery (ORIF) to reattach the bone fragment. Physiotherapy is essential for rehabilitation."),
("What is a stress fracture?", "A stress fracture is a small crack or severe bruising within a bone, often caused by repetitive force or overuse, such as from running, jumping, or marching."),
("What medications are used for pain relief in a stress fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for pain relief. NSAIDs (e.g., ibuprofen, naproxen) may be avoided if advised by a doctor, as they can delay bone healing."),
("How is a stress fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Severe cases may require surgery. Physiotherapy is essential for rehabilitation."),
("What is an impacted fracture?", "An impacted fracture occurs when the broken bone fragments are driven into each other, causing the bone to compress, typically resulting from high-impact trauma such as car accidents or falls."),
("What medications are used for pain relief in an impacted fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an impacted fracture treated?", "Treatment includes immobilization with a cast, splint, or brace for 4–6 weeks. Severe or displaced fractures may require surgery (ORIF) or bone grafting. Physiotherapy is essential for rehabilitation."),
("What is a pathological fracture?", "A pathological fracture occurs when a bone breaks due to an underlying disease or condition that weakens the bone, such as osteoporosis, cancer, or infection."),
("What medications are used for pain relief in a pathological fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a pathological fracture treated?", "Treatment focuses on addressing the underlying condition causing the fracture. Immobilization with a cast or splint may be used, and surgery (ORIF) may be necessary for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a buckle fracture?", "A buckle fracture, also known as a torus fracture, occurs when the bone compresses or buckles on one side, typically seen in children due to their softer bones."),
("What medications are used for pain relief in a buckle fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a buckle fracture treated?", "Treatment includes immobilization with a splint or cast for 3–4 weeks. Surgery is rarely required. Physiotherapy may be recommended for rehabilitation."),
("What is a compound fracture?", "A compound fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a compound fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a compound fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a hairline fracture?", "A hairline fracture is a small crack in the bone that does not cause the bone to separate, often caused by repetitive stress or overuse."),
("What medications are used for pain relief in a hairline fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a hairline fracture treated?", "Treatment includes rest, immobilization with a splint or brace, and gradual return to activity. Physiotherapy may be recommended for rehabilitation."),
("What is a displaced fracture?", "A displaced fracture occurs when the broken bone fragments are misaligned, often requiring realignment for proper healing."),
("What medications are used for pain relief in a displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a displaced fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a non-displaced fracture?", "A non-displaced fracture occurs when the bone breaks but the fragments remain aligned, often requiring less intensive treatment."),
("What medications are used for pain relief in a non-displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a non-displaced fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a fatigue fracture?", "A fatigue fracture, also known as a stress fracture, occurs due to repetitive stress or overuse, often seen in athletes or military personnel."),
("What medications are used for pain relief in a fatigue fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a fatigue fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Physiotherapy is essential for rehabilitation."),
("What is a complete fracture?", "A complete fracture occurs when the bone breaks into two or more separate pieces, often requiring more intensive treatment."),
("What medications are used for pain relief in a complete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a complete fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an incomplete fracture?", "An incomplete fracture occurs when the bone cracks but does not break completely, often seen in children due to their softer bones."),
("What medications are used for pain relief in an incomplete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an incomplete fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a closed fracture?", "A closed fracture occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a closed fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a closed fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an open fracture?", "An open fracture, also known as a compound fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in an open fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is an open fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a stable fracture?", "A stable fracture occurs when the broken bone fragments remain aligned and do not move out of place, often requiring less intensive treatment."),
("What medications are used for pain relief in a stable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a stable fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is an unstable fracture?", "An unstable fracture occurs when the broken bone fragments are misaligned or move out of place, often requiring more intensive treatment."),
("What medications are used for pain relief in an unstable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an unstable fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a simple fracture?", "A simple fracture, also known as a closed fracture, occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a simple fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a simple fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a complex fracture?", "A complex fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a complex fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a complex fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a comminuted fracture?", "A comminuted fracture occurs when a bone is broken into three or more pieces, often caused by high-impact trauma such as a car accident or severe fall."),
("What medications are used for pain management in a comminuted fracture?", "Over-the-counter painkillers like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a comminuted fracture treated?", "Treatment typically involves surgery (ORIF) to stabilize the bone fragments with metal plates, screws, or rods. External fixation or bone grafting may also be used. Physiotherapy is crucial post-healing."),
("What is a spiral fracture?", "A spiral fracture is a type of bone fracture where the bone breaks in a spiral pattern, usually caused by a twisting or rotational force, often seen in sports injuries or accidents."),
("What medications are used for pain relief in a spiral fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers may be prescribed in severe cases."),
("How is a spiral fracture treated?", "Treatment includes immobilization with a plaster cast or splint for 6–8 weeks. Severe or displaced fractures may require surgical realignment (ORIF) or external fixation. Physiotherapy is essential post-healing."),
("What is a compression fracture?", "A compression fracture occurs when a bone, typically in the spine (vertebrae), is compressed or crushed due to excessive pressure, often associated with osteoporosis, trauma, or metastatic cancer."),
("What medications are used for pain management in a compression fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be needed for severe pain."),
("How is a compression fracture treated?", "Treatment includes rest, pain relief, and bracing for minor fractures. Severe cases may require surgery (vertebroplasty or kyphoplasty). Physiotherapy is essential for restoring mobility and strength."),
("What is a segmental fracture?", "A segmental fracture occurs when the same bone is fractured in two or more separate places, leaving at least one bone fragment isolated between the breaks, typically caused by high-energy trauma."),
("What medications are used for pain relief in a segmental fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a segmental fracture treated?", "Treatment typically involves surgery (ORIF) to stabilize the bone fragments with metal plates, screws, or rods. External fixation or bone grafting may also be used. Physiotherapy is crucial post-healing."),
("What is an avulsion fracture?", "An avulsion fracture occurs when a small piece of bone is torn away from the main bone due to a sudden, strong pull by a ligament or tendon, often associated with sports injuries."),
("What medications are used for pain relief in an avulsion fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an avulsion fracture treated?", "Treatment includes immobilization with a splint or cast for 4–6 weeks. Severe cases may require surgery (ORIF) to reattach the bone fragment. Physiotherapy is essential for rehabilitation."),
("What is a stress fracture?", "A stress fracture is a small crack or severe bruising within a bone, often caused by repetitive force or overuse, such as from running, jumping, or marching."),
("What medications are used for pain relief in a stress fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for pain relief. NSAIDs (e.g., ibuprofen, naproxen) may be avoided if advised by a doctor, as they can delay bone healing."),
("How is a stress fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Severe cases may require surgery. Physiotherapy is essential for rehabilitation."),
("What is an impacted fracture?", "An impacted fracture occurs when the broken bone fragments are driven into each other, causing the bone to compress, typically resulting from high-impact trauma such as car accidents or falls."),
("What medications are used for pain relief in an impacted fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an impacted fracture treated?", "Treatment includes immobilization with a cast, splint, or brace for 4–6 weeks. Severe or displaced fractures may require surgery (ORIF) or bone grafting. Physiotherapy is essential for rehabilitation."),
("What is a pathological fracture?", "A pathological fracture occurs when a bone breaks due to an underlying disease or condition that weakens the bone, such as osteoporosis, cancer, or infection."),
("What medications are used for pain relief in a pathological fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a pathological fracture treated?", "Treatment focuses on addressing the underlying condition causing the fracture. Immobilization with a cast or splint may be used, and surgery (ORIF) may be necessary for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a buckle fracture?", "A buckle fracture, also known as a torus fracture, occurs when the bone compresses or buckles on one side, typically seen in children due to their softer bones."),
("What medications are used for pain relief in a buckle fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a buckle fracture treated?", "Treatment includes immobilization with a splint or cast for 3–4 weeks. Surgery is rarely required. Physiotherapy may be recommended for rehabilitation."),
("What is a compound fracture?", "A compound fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a compound fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a compound fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a hairline fracture?", "A hairline fracture is a small crack in the bone that does not cause the bone to separate, often caused by repetitive stress or overuse."),
("What medications are used for pain relief in a hairline fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a hairline fracture treated?", "Treatment includes rest, immobilization with a splint or brace, and gradual return to activity. Physiotherapy may be recommended for rehabilitation."),
("What is a displaced fracture?", "A displaced fracture occurs when the broken bone fragments are misaligned, often requiring realignment for proper healing."),
("What medications are used for pain relief in a displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a displaced fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a non-displaced fracture?", "A non-displaced fracture occurs when the bone breaks but the fragments remain aligned, often requiring less intensive treatment."),
("What medications are used for pain relief in a non-displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a non-displaced fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a fatigue fracture?", "A fatigue fracture, also known as a stress fracture, occurs due to repetitive stress or overuse, often seen in athletes or military personnel."),
("What medications are used for pain relief in a fatigue fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a fatigue fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Physiotherapy is essential for rehabilitation."),
("What is a complete fracture?", "A complete fracture occurs when the bone breaks into two or more separate pieces, often requiring more intensive treatment."),
("What medications are used for pain relief in a complete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a complete fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an incomplete fracture?", "An incomplete fracture occurs when the bone cracks but does not break completely, often seen in children due to their softer bones."),
("What medications are used for pain relief in an incomplete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an incomplete fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a closed fracture?", "A closed fracture occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a closed fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a closed fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an open fracture?", "An open fracture, also known as a compound fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in an open fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is an open fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a stable fracture?", "A stable fracture occurs when the broken bone fragments remain aligned and do not move out of place, often requiring less intensive treatment."),
("What medications are used for pain relief in a stable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a stable fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is an unstable fracture?", "An unstable fracture occurs when the broken bone fragments are misaligned or move out of place, often requiring more intensive treatment."),
("What medications are used for pain relief in an unstable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an unstable fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a simple fracture?", "A simple fracture, also known as a closed fracture, occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a simple fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a simple fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a complex fracture?", "A complex fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a complex fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a complex fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a compression fracture?", "A compression fracture occurs when a bone, typically in the spine (vertebrae), is compressed or crushed due to excessive pressure, often associated with osteoporosis, trauma, or metastatic cancer."),
("What medications are used for pain management in a compression fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be needed for severe pain."),
("How is a compression fracture treated?", "Treatment includes rest, pain relief, and bracing for minor fractures. Severe cases may require surgery (vertebroplasty or kyphoplasty). Physiotherapy is essential for restoring mobility and strength."),
("What is a segmental fracture?", "A segmental fracture occurs when the same bone is fractured in two or more separate places, leaving at least one bone fragment isolated between the breaks, typically caused by high-energy trauma."),
("What medications are used for pain relief in a segmental fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a segmental fracture treated?", "Treatment typically involves surgery (ORIF) to stabilize the bone fragments with metal plates, screws, or rods. External fixation or bone grafting may also be used. Physiotherapy is crucial post-healing."),
("What is an avulsion fracture?", "An avulsion fracture occurs when a small piece of bone is torn away from the main bone due to a sudden, strong pull by a ligament or tendon, often associated with sports injuries."),
("What medications are used for pain relief in an avulsion fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an avulsion fracture treated?", "Treatment includes immobilization with a splint or cast for 4–6 weeks. Severe cases may require surgery (ORIF) to reattach the bone fragment. Physiotherapy is essential for rehabilitation."),
("What is a stress fracture?", "A stress fracture is a small crack or severe bruising within a bone, often caused by repetitive force or overuse, such as from running, jumping, or marching."),
("What medications are used for pain relief in a stress fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for pain relief. NSAIDs (e.g., ibuprofen, naproxen) may be avoided if advised by a doctor, as they can delay bone healing."),
("How is a stress fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Severe cases may require surgery. Physiotherapy is essential for rehabilitation."),
("What is an impacted fracture?", "An impacted fracture occurs when the broken bone fragments are driven into each other, causing the bone to compress, typically resulting from high-impact trauma such as car accidents or falls."),
("What medications are used for pain relief in an impacted fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an impacted fracture treated?", "Treatment includes immobilization with a cast, splint, or brace for 4–6 weeks. Severe or displaced fractures may require surgery (ORIF) or bone grafting. Physiotherapy is essential for rehabilitation."),
("What is a pathological fracture?", "A pathological fracture occurs when a bone breaks due to an underlying disease or condition that weakens the bone, such as osteoporosis, cancer, or infection."),
("What medications are used for pain relief in a pathological fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a pathological fracture treated?", "Treatment focuses on addressing the underlying condition causing the fracture. Immobilization with a cast or splint may be used, and surgery (ORIF) may be necessary for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a buckle fracture?", "A buckle fracture, also known as a torus fracture, occurs when the bone compresses or buckles on one side, typically seen in children due to their softer bones."),
("What medications are used for pain relief in a buckle fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a buckle fracture treated?", "Treatment includes immobilization with a splint or cast for 3–4 weeks. Surgery is rarely required. Physiotherapy may be recommended for rehabilitation."),
("What is a compound fracture?", "A compound fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a compound fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a compound fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a hairline fracture?", "A hairline fracture is a small crack in the bone that does not cause the bone to separate, often caused by repetitive stress or overuse."),
("What medications are used for pain relief in a hairline fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a hairline fracture treated?", "Treatment includes rest, immobilization with a splint or brace, and gradual return to activity. Physiotherapy may be recommended for rehabilitation."),
("What is a displaced fracture?", "A displaced fracture occurs when the broken bone fragments are misaligned, often requiring realignment for proper healing."),
("What medications are used for pain relief in a displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a displaced fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a non-displaced fracture?", "A non-displaced fracture occurs when the bone breaks but the fragments remain aligned, often requiring less intensive treatment."),
("What medications are used for pain relief in a non-displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a non-displaced fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a fatigue fracture?", "A fatigue fracture, also known as a stress fracture, occurs due to repetitive stress or overuse, often seen in athletes or military personnel."),
("What medications are used for pain relief in a fatigue fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a fatigue fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Physiotherapy is essential for rehabilitation."),
("What is a complete fracture?", "A complete fracture occurs when the bone breaks into two or more separate pieces, often requiring more intensive treatment."),
("What medications are used for pain relief in a complete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a complete fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an incomplete fracture?", "An incomplete fracture occurs when the bone cracks but does not break completely, often seen in children due to their softer bones."),
("What medications are used for pain relief in an incomplete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an incomplete fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a closed fracture?", "A closed fracture occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a closed fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a closed fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an open fracture?", "An open fracture, also known as a compound fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in an open fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is an open fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a stable fracture?", "A stable fracture occurs when the broken bone fragments remain aligned and do not move out of place, often requiring less intensive treatment."),
("What medications are used for pain relief in a stable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a stable fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is an unstable fracture?", "An unstable fracture occurs when the broken bone fragments are misaligned or move out of place, often requiring more intensive treatment."),
("What medications are used for pain relief in an unstable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an unstable fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a simple fracture?", "A simple fracture, also known as a closed fracture, occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a simple fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a simple fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a complex fracture?", "A complex fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a complex fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a complex fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a comminuted fracture?", "A comminuted fracture occurs when a bone is broken into three or more pieces, often caused by high-impact trauma such as a car accident or severe fall."),
("What medications are used for pain management in a comminuted fracture?", "Over-the-counter painkillers like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a comminuted fracture treated?", "Treatment typically involves surgery (ORIF) to stabilize the bone fragments with metal plates, screws, or rods. External fixation or bone grafting may also be used. Physiotherapy is crucial post-healing."),
("What is a spiral fracture?", "A spiral fracture is a type of bone fracture where the bone breaks in a spiral pattern, usually caused by a twisting or rotational force, often seen in sports injuries or accidents."),
("What medications are used for pain relief in a spiral fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers may be prescribed in severe cases."),
("How is a spiral fracture treated?", "Treatment includes immobilization with a plaster cast or splint for 6–8 weeks. Severe or displaced fractures may require surgical realignment (ORIF) or external fixation. Physiotherapy is essential post-healing."),
("What is a compression fracture?", "A compression fracture occurs when a bone, typically in the spine (vertebrae), is compressed or crushed due to excessive pressure, often associated with osteoporosis, trauma, or metastatic cancer."),
("What medications are used for pain management in a compression fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be needed for severe pain."),
("How is a compression fracture treated?", "Treatment includes rest, pain relief, and bracing for minor fractures. Severe cases may require surgery (vertebroplasty or kyphoplasty). Physiotherapy is essential for restoring mobility and strength."),
("What is a segmental fracture?", "A segmental fracture occurs when the same bone is fractured in two or more separate places, leaving at least one bone fragment isolated between the breaks, typically caused by high-energy trauma."),
("What medications are used for pain relief in a segmental fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a segmental fracture treated?", "Treatment typically involves surgery (ORIF) to stabilize the bone fragments with metal plates, screws, or rods. External fixation or bone grafting may also be used. Physiotherapy is crucial post-healing."),
("What is an avulsion fracture?", "An avulsion fracture occurs when a small piece of bone is torn away from the main bone due to a sudden, strong pull by a ligament or tendon, often associated with sports injuries."),
("What medications are used for pain relief in an avulsion fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an avulsion fracture treated?", "Treatment includes immobilization with a splint or cast for 4–6 weeks. Severe cases may require surgery (ORIF) to reattach the bone fragment. Physiotherapy is essential for rehabilitation."),
("What is a stress fracture?", "A stress fracture is a small crack or severe bruising within a bone, often caused by repetitive force or overuse, such as from running, jumping, or marching."),
("What medications are used for pain relief in a stress fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for pain relief. NSAIDs (e.g., ibuprofen, naproxen) may be avoided if advised by a doctor, as they can delay bone healing."),
("How is a stress fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Severe cases may require surgery. Physiotherapy is essential for rehabilitation."),
("What is an impacted fracture?", "An impacted fracture occurs when the broken bone fragments are driven into each other, causing the bone to compress, typically resulting from high-impact trauma such as car accidents or falls."),
("What medications are used for pain relief in an impacted fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an impacted fracture treated?", "Treatment includes immobilization with a cast, splint, or brace for 4–6 weeks. Severe or displaced fractures may require surgery (ORIF) or bone grafting. Physiotherapy is essential for rehabilitation."),
("What is a pathological fracture?", "A pathological fracture occurs when a bone breaks due to an underlying disease or condition that weakens the bone, such as osteoporosis, cancer, or infection."),
("What medications are used for pain relief in a pathological fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a pathological fracture treated?", "Treatment focuses on addressing the underlying condition causing the fracture. Immobilization with a cast or splint may be used, and surgery (ORIF) may be necessary for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a buckle fracture?", "A buckle fracture, also known as a torus fracture, occurs when the bone compresses or buckles on one side, typically seen in children due to their softer bones."),
("What medications are used for pain relief in a buckle fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and ibuprofen or naproxen for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a buckle fracture treated?", "Treatment includes immobilization with a splint or cast for 3–4 weeks. Surgery is rarely required. Physiotherapy may be recommended for rehabilitation."),
("What is a compound fracture?", "A compound fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a compound fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a compound fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a hairline fracture?", "A hairline fracture is a small crack in the bone that does not cause the bone to separate, often caused by repetitive stress or overuse."),
("What medications are used for pain relief in a hairline fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a hairline fracture treated?", "Treatment includes rest, immobilization with a splint or brace, and gradual return to activity. Physiotherapy may be recommended for rehabilitation."),
("What is a displaced fracture?", "A displaced fracture occurs when the broken bone fragments are misaligned, often requiring realignment for proper healing."),
("What medications are used for pain relief in a displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a displaced fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a non-displaced fracture?", "A non-displaced fracture occurs when the bone breaks but the fragments remain aligned, often requiring less intensive treatment."),
("What medications are used for pain relief in a non-displaced fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a non-displaced fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a fatigue fracture?", "A fatigue fracture, also known as a stress fracture, occurs due to repetitive stress or overuse, often seen in athletes or military personnel."),
("What medications are used for pain relief in a fatigue fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a fatigue fracture treated?", "Treatment includes rest, immobilization with a walking boot or brace, and gradual return to activity. Physiotherapy is essential for rehabilitation."),
("What is a complete fracture?", "A complete fracture occurs when the bone breaks into two or more separate pieces, often requiring more intensive treatment."),
("What medications are used for pain relief in a complete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a complete fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an incomplete fracture?", "An incomplete fracture occurs when the bone cracks but does not break completely, often seen in children due to their softer bones."),
("What medications are used for pain relief in an incomplete fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is an incomplete fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is a closed fracture?", "A closed fracture occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a closed fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a closed fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is an open fracture?", "An open fracture, also known as a compound fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in an open fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is an open fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
("What is a stable fracture?", "A stable fracture occurs when the broken bone fragments remain aligned and do not move out of place, often requiring less intensive treatment."),
("What medications are used for pain relief in a stable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers are rarely needed."),
("How is a stable fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Physiotherapy may be recommended for rehabilitation."),
("What is an unstable fracture?", "An unstable fracture occurs when the broken bone fragments are misaligned or move out of place, often requiring more intensive treatment."),
("What medications are used for pain relief in an unstable fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is an unstable fracture treated?", "Treatment includes realignment of the bone fragments (reduction) followed by immobilization with a cast or splint. Surgery (ORIF) may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a simple fracture?", "A simple fracture, also known as a closed fracture, occurs when the bone breaks but does not pierce the skin, reducing the risk of infection."),
("What medications are used for pain relief in a simple fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers may be prescribed for severe pain."),
("How is a simple fracture treated?", "Treatment includes immobilization with a cast or splint for 4–6 weeks. Surgery may be required for severe fractures. Physiotherapy is essential for rehabilitation."),
("What is a complex fracture?", "A complex fracture, also known as an open fracture, occurs when the broken bone pierces through the skin, increasing the risk of infection."),
("What medications are used for pain relief in a complex fracture?", "Over-the-counter medications like acetaminophen (Paracetamol) for mild to moderate pain, and NSAIDs (e.g., ibuprofen, naproxen) for pain and inflammation. Stronger painkillers (e.g., opioids) may be prescribed for severe pain."),
("How is a complex fracture treated?", "Treatment includes immediate surgery to clean the wound, stabilize the bone with metal plates, screws, or rods, and prevent infection. Antibiotics are often prescribed. Physiotherapy is essential post-healing."),
]
# Step 4: Define a function to generate answers
def ask_question(question):
# Check if the question is in the dataset
for q, a in qa_data:
if question.lower() == q.lower():
return a
# If the question is not in the dataset, generate a response using the model
input_text = f"Question: {question} Answer:"
input_ids = tokenizer.encode(input_text, return_tensors="pt")
with torch.no_grad():
output = model.generate(
input_ids,
max_length=1024,
num_return_sequences=1,
no_repeat_ngram_size=2,
do_sample=True,
top_k=50,
top_p=0.95,
temperature=0.7
)
answer = tokenizer.decode(output[0], skip_special_tokens=True)
answer = answer.split("Answer:")[-1].strip()
# If the model fails to generate a meaningful response, return a default message
if not answer or answer.lower() == "answer:":
return "I'm sorry, but I don't have information about that. I can only provide information related to fracture"
return answer
# Step 5: Create the Gradio interface
def chat_interface(input_text, chat_history=[]):
# Handle greetings
greetings = ["hi", "hello", "aslam o alikum"]
if input_text.strip().lower() in greetings:
bot_response = "Hello! How can I assist you with airline-related questions?"
else:
# Handle other questions
bot_response = ask_question(input_text)
# Update chat history
chat_history.append((input_text, bot_response))
# Return updated chat history
return chat_history, chat_history
# Step 6: Launch the Gradio app
with gr.Blocks() as iface:
gr.Markdown("# Fracture Chatbot\nAsk me anything about fractures!")
# Chatbot component
chat_history = gr.Chatbot(label="Chatbot")
# Input textbox and send button
with gr.Row():
user_input = gr.Textbox(label="You", placeholder="Type your message here...", lines=2)
send_button = gr.Button("Send")
# Examples
gr.Examples(
examples=[
"What medications are used for pain relief in a segmental fracture?",
"How is an impacted fracture treated?",
"What medications are used for pain relief in a simple fracture?"
],
inputs=user_input
)
# Connect the send button to the chat interface
send_button.click(
fn=chat_interface,
inputs=[user_input, chat_history],
outputs=[chat_history, chat_history]
)
iface.launch(debug=True)