Spaces:
Running
Running
| import gradio as gr | |
| from transformers import pipeline | |
| def medical_chatbot(question): | |
| model_name = "AventIQ-AI/t5-medical-chatbot" | |
| generator = pipeline("text2text-generation", model=model_name) | |
| instruction = "As a medical expert, provide a detailed and accurate diagnosis based on the patient's symptoms." | |
| input_text = f"{instruction} {question}" | |
| response = generator(input_text, max_length=256)[0]['generated_text'] | |
| return response | |
| iface = gr.Interface( | |
| fn=medical_chatbot, | |
| inputs=gr.Textbox(label="🩺 Ask a Medical Question", placeholder="Describe your symptoms or ask a medical query...", lines=3), | |
| outputs=gr.Textbox(label="💡 Expert Diagnosis", interactive=True), | |
| title="🔬 AI-Powered Medical Chatbot", | |
| description="🤖 Enter a medical question, and the chatbot will generate a detailed response based on expert knowledge.", | |
| theme="compact", | |
| allow_flagging="never", | |
| examples=[ | |
| ["I have a fever and sore throat. What could it be?"], | |
| ["What are the symptoms of diabetes?"], | |
| ["How can I manage high blood pressure naturally?"] | |
| ], | |
| ) | |
| if __name__ == "__main__": | |
| iface.launch() | |