| import gradio as gr |
|
|
| |
| dental_terms = { |
| "cavity": "A cavity is a hole in a tooth caused by decay.", |
| "gingivitis": "Gingivitis is the inflammation of the gums, often caused by plaque buildup.", |
| "implant": "A dental implant is a surgical component that interfaces with the jawbone to support a dental prosthesis.", |
| "orthodontics": "Orthodontics is a branch of dentistry that corrects teeth and jaw alignment issues.", |
| "plaque": "Plaque is a sticky, colorless film of bacteria that forms on teeth.", |
| "enamel": "Enamel is the hard, outer surface layer of your teeth that protects against decay.", |
| "braces": "Braces are orthodontic devices used to straighten teeth and correct bite issues.", |
| "root canal": "A root canal is a treatment to repair and save a badly damaged or infected tooth.", |
| "crown": "A crown is a dental cap placed over a tooth to restore its shape, size, and strength.", |
| "veneers": "Veneers are thin shells placed over the front of teeth to improve appearance.", |
| "halitosis": "Halitosis is chronic bad breath caused by bacteria or other factors.", |
| "periodontitis": "Periodontitis is a serious gum infection that damages gums and can destroy the jawbone.", |
| "denture": "Dentures are removable appliances that replace missing teeth and surrounding tissues.", |
| "bridge": "A dental bridge is a fixed prosthetic device that replaces missing teeth.", |
| "tartar": "Tartar is hardened plaque that forms on teeth and can only be removed by a dentist.", |
| "x-ray": "A dental x-ray is an imaging technique used to view the inside of teeth and surrounding tissues.", |
| "flossing": "Flossing is the process of cleaning between your teeth with dental floss.", |
| "sealant": "A sealant is a protective coating applied to teeth to prevent decay.", |
| "bitewing": "A bitewing is a type of dental x-ray that shows the upper and lower back teeth.", |
| "occlusion": "Occlusion refers to the alignment and contact between teeth when the jaws close." |
| } |
|
|
| def chatbot_response(message, history): |
| |
| message = message.lower() |
|
|
| |
| if message in dental_terms: |
| return dental_terms[message] |
| else: |
| return "I'm sorry, I am just a simple chatbot, and I don't understand that term. Please try another dental term." |
|
|
| |
| demo = gr.ChatInterface( |
| chatbot_response, |
| type="messages", |
| title="Dental Terminology Chatbot", |
| description="Enter a dental term to get its definition. If the term is not recognized, the chatbot will let you know." |
| ) |
|
|
| if __name__ == "__main__": |
| demo.launch() |
|
|