import gradio as gr from transformers import pipeline import time # Load Bangla model bangla_ai = pipeline("text2text-generation", model="csebuetnlp/banglat5") # Bangladesh Flag Colors BD_GREEN = "#006a4e" BD_RED = "#f42a41" # Custom CSS with Animations custom_css = f""" footer {{visibility: hidden}} @import url('https://fonts.maateen.me/kalpurush/font.css'); .bangla-font * {{ font-family: "Kalpurush", "Siyam Rupali", sans-serif !important; }} /* Welcome Animation */ @keyframes welcome {{ 0% {{ transform: scale(0.8); opacity: 0; }} 100% {{ transform: scale(1); opacity: 1; }} }} .welcome-anim {{ animation: welcome 1s ease-out; }} /* Thinking Dots */ .thinking-dots {{ display: inline-block; }} .thinking-dots span {{ display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: {BD_GREEN}; margin: 0 2px; opacity: 0; }} .thinking-dots span:nth-child(1) {{ animation: dot-pulse 1.5s infinite; }} .thinking-dots span:nth-child(2) {{ animation: dot-pulse 1.5s infinite 0.2s; }} .thinking-dots span:nth-child(3) {{ animation: dot-pulse 1.5s infinite 0.4s; }} @keyframes dot-pulse {{ 0%, 100% {{ opacity: 0.3; transform: translateY(0); }} 50% {{ opacity: 1; transform: translateY(-5px); }} }} /* Button Style */ button {{ background: {BD_GREEN} !important; color: white !important; }} button:hover {{ background: {BD_RED} !important; }} """ def chat(message, history): # Show thinking dots yield "প্রস্তুত হচ্ছে...
জাতীয় জ্ঞান সহায়ক