|
|
import gradio as gr |
|
|
from difflib import get_close_matches |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FAQ = { |
|
|
|
|
|
"courses": """ |
|
|
NIELIT Major Courses: |
|
|
β’ CCC, BCC (Digital Literacy) |
|
|
β’ O Level (Diploma Equivalent) |
|
|
β’ A Level (Advanced Diploma) |
|
|
β’ B Level (MCA Equivalent) |
|
|
β’ C Level (M.Tech Equivalent) |
|
|
β’ Diploma β Hardware, Software, AI, ML, IoT, Cyber Security |
|
|
β’ Short Courses β Python, Java, C, C++, Web Designing, Data Science |
|
|
β’ B.Tech Engineering Programs (CS, IT, Electronics) β Center Wise |
|
|
""", |
|
|
|
|
|
"fees": """ |
|
|
NIELIT Fee Structure (Approx): |
|
|
β’ CCC: βΉ500β800 |
|
|
β’ O Level: βΉ14,000β17,000 |
|
|
β’ A Level: βΉ20,000β35,000 |
|
|
β’ Diploma: βΉ18,000β45,000 |
|
|
β’ Short Courses (Python/Java/AI): βΉ1500β6000 |
|
|
β’ B.Tech Fee: βΉ50,000 per semester |
|
|
""", |
|
|
|
|
|
"btech": """ |
|
|
NIELIT B.Tech Fee & Details: |
|
|
β’ Fee: βΉ50,000 per semester |
|
|
β’ Courses: B.Tech in CSE, IT, ECE (center-specific) |
|
|
β’ Duration: 4 Years |
|
|
β’ Admission: JEE / Institute Entrance |
|
|
β’ Facilities: Labs, Project Work, Industry Training |
|
|
""", |
|
|
|
|
|
"ccc": """ |
|
|
CCC Details: |
|
|
β’ Duration: 80 Hours |
|
|
β’ Syllabus: Basics, MS Office, Internet |
|
|
β’ Exam Every Month |
|
|
β’ Registration: https://student.nielit.gov.in |
|
|
""", |
|
|
|
|
|
"o level": """ |
|
|
O Level Details: |
|
|
β’ Duration: 1 Year |
|
|
β’ Eligibility: 12th / ITI / Computer Course |
|
|
β’ Syllabus: IT Tools, Web Design, Python/C Programming |
|
|
β’ Fee: ~ βΉ15,000 |
|
|
""", |
|
|
|
|
|
"a level": """ |
|
|
A Level Details: |
|
|
β’ Duration: 1.5 Years |
|
|
β’ Eligibility: O Level / Graduation |
|
|
β’ Fee: βΉ20,000β35,000 |
|
|
""", |
|
|
|
|
|
"ropar": """ |
|
|
NIELIT Ropar Courses: |
|
|
β’ Diploma in CS |
|
|
β’ AI, ML, IoT |
|
|
β’ Embedded Systems |
|
|
β’ Cyber Security |
|
|
β’ Python, Java, C, C++ |
|
|
""", |
|
|
|
|
|
"admission": """ |
|
|
NIELIT Admission Process: |
|
|
1. Choose Course |
|
|
2. Register Online |
|
|
3. Upload Documents |
|
|
4. Pay Fees |
|
|
5. Attend Classes / Exams |
|
|
""", |
|
|
|
|
|
"syllabus": """ |
|
|
NIELIT Syllabus: |
|
|
β’ CCC β Computer Basics, MS Office |
|
|
β’ O Level β IT Tools, Python, Web Dev |
|
|
β’ A Level β OS, DBMS, AI, ML Basics |
|
|
""", |
|
|
|
|
|
"certificate": """ |
|
|
NIELIT Certificates are: |
|
|
β Government Recognized |
|
|
β Valid for Government Jobs |
|
|
β PSU Eligible |
|
|
""", |
|
|
|
|
|
"placement": """ |
|
|
NIELIT Placement Support: |
|
|
β’ IT Companies |
|
|
β’ Digital India Projects |
|
|
β’ Technical Support Roles |
|
|
β’ Skill India Programs |
|
|
""", |
|
|
|
|
|
"contact": """ |
|
|
Visit: https://nielit.ac.in |
|
|
Student Portal: https://student.nielit.gov.in |
|
|
""" |
|
|
} |
|
|
|
|
|
KEYS = list(FAQ.keys()) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fast_bot(message, history): |
|
|
text = message.lower() |
|
|
|
|
|
|
|
|
for key in KEYS: |
|
|
if key in text: |
|
|
answer = FAQ[key] |
|
|
history.append((message, answer)) |
|
|
return history, history |
|
|
|
|
|
|
|
|
match = get_close_matches(text, KEYS, n=1, cutoff=0.3) |
|
|
if match: |
|
|
answer = FAQ[match[0]] |
|
|
history.append((message, answer)) |
|
|
return history, history |
|
|
|
|
|
|
|
|
fallback = "Please check the official website for more details: https://nielit.ac.in" |
|
|
history.append((message, fallback)) |
|
|
return history, history |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with gr.Blocks() as demo: |
|
|
|
|
|
gr.Markdown(""" |
|
|
# β‘ Ultra-Fast NIELIT Chatbot |
|
|
### Instant Response | Full Course + Fees Info | Includes B.Tech Fees |
|
|
""") |
|
|
|
|
|
chat = gr.Chatbot() |
|
|
state = gr.State([]) |
|
|
|
|
|
box = gr.Textbox(placeholder="Ask anything about NIELIT (Hindi/English)...") |
|
|
|
|
|
box.submit(fast_bot, [box, state], [chat, state]) |
|
|
box.submit(lambda: "", None, box) |
|
|
|
|
|
demo.launch() |
|
|
|