ruthran commited on
Commit
b4e2009
·
verified ·
1 Parent(s): 4ee972f

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +106 -0
  2. prospectus-context.txt +116 -0
  3. requirements.txt +4 -0
app.py ADDED
@@ -0,0 +1,106 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import gradio as gr
3
+ import os
4
+ import google.generativeai as genai
5
+ from dotenv import load_dotenv
6
+
7
+ # Load environment variables (for local testing)
8
+ load_dotenv()
9
+
10
+ # --- Configuration ---
11
+ API_KEY = os.getenv("GEMINI_API_KEY")
12
+ CONTEXT_FILE = "prospectus-context.txt"
13
+
14
+ if not API_KEY:
15
+ print("Error: GEMINI_API_KEY not found. Please set it in secrets or .env file.")
16
+ # raise ValueError("API Key not configured")
17
+
18
+ # Load Prospectus Context
19
+ try:
20
+ context_path = os.path.join(os.path.dirname(__file__), CONTEXT_FILE)
21
+ with open(context_path, "r", encoding="utf-8") as f:
22
+ prospectus_context = f.read()
23
+ print("Prospectus context loaded successfully.")
24
+ except FileNotFoundError:
25
+ print(f"Error: Context file '{CONTEXT_FILE}' not found at expected path: {context_path}")
26
+ prospectus_context = "Error: Course context is unavailable. Cannot answer questions accurately."
27
+ except Exception as e:
28
+ print(f"Error loading context file: {e}")
29
+ prospectus_context = "Error: Failed to load course context."
30
+
31
+ # --- Gemini API Setup ---
32
+ try:
33
+ genai.configure(api_key=API_KEY)
34
+ model = genai.GenerativeModel(
35
+ model_name="gemini-1.5-flash-latest",
36
+ )
37
+ print("Gemini model initialized successfully.")
38
+ except Exception as e:
39
+ print(f"Error initializing Gemini model: {e}")
40
+ model = None
41
+
42
+ # --- Core Chat Logic ---
43
+ def get_gemini_response(user_query, chat_history):
44
+ if not model:
45
+ return "Sorry, the AI model is not available at the moment. Please try again later."
46
+ if "Error: Course context is unavailable" in prospectus_context:
47
+ return prospectus_context
48
+
49
+ full_prompt = f"""
50
+ You are a helpful and concise FAQ assistant for HERE AND NOW AI. Your primary goal is to answer questions based *only* on the provided course prospectus information below. Do not invent information or answer questions outside this context. If the answer isn't in the text, clearly state that you don't have the information and suggest contacting the institute via [email protected]. Keep responses brief and clear.
51
+
52
+ **Prospectus Context:**
53
+ ---
54
+ {prospectus_context}
55
+ ---
56
+
57
+ **User Question:** {user_query}
58
+
59
+ **Answer:**"""
60
+
61
+ try:
62
+ response = model.generate_content(full_prompt)
63
+ ai_response_text = "Sorry, I encountered an issue generating a response. Please try asking differently or contact support."
64
+
65
+ if hasattr(response, 'text') and response.text:
66
+ ai_response_text = response.text
67
+ elif hasattr(response, 'prompt_feedback') and response.prompt_feedback and hasattr(response.prompt_feedback, 'block_reason'):
68
+ ai_response_text = f"Your request was blocked: {response.prompt_feedback.block_reason}. Please rephrase."
69
+ elif hasattr(response, 'candidates') and response.candidates and hasattr(response.candidates[0], 'finish_reason') and response.candidates[0].finish_reason != 'STOP':
70
+ ai_response_text = f"The response was incomplete ({response.candidates[0].finish_reason}). Please try again."
71
+
72
+ lc = ai_response_text.lower()
73
+ if "don't know" in lc or "don't have information" in lc or "not mentioned" in lc or "cannot answer" in lc:
74
+ if "[email protected]" not in ai_response_text:
75
+ ai_response_text += " For more details, please contact [email protected]."
76
+
77
+ return ai_response_text.strip()
78
+
79
+ except Exception as e:
80
+ print(f"Error during Gemini API call: {e}")
81
+ return "An error occurred while contacting the AI service. Please try again."
82
+
83
+ # --- Gradio Interface ---
84
+ chatbot_interface = gr.ChatInterface(
85
+ fn=get_gemini_response,
86
+ chatbot=gr.Chatbot(height=400, label="Chat Window"),
87
+ textbox=gr.Textbox(placeholder="Ask about our AI courses...", container=False, scale=7),
88
+ title="HERE AND NOW AI Course FAQ Bot",
89
+ description="Ask me questions about the Business Analytics with AI or Full-Stack AI Developer programs (based on the 2025-2026 prospectus).",
90
+ theme=gr.themes.Soft(primary_hue="blue", secondary_hue="purple"),
91
+ examples=[
92
+ "What prerequisites are needed for the Business Analytics course?",
93
+ "Tell me about the Full-Stack AI Developer curriculum.",
94
+ "Who is the CEO?",
95
+ "What is the fee for the full-stack program?",
96
+ "Do you offer placement assistance?",
97
+ ],
98
+ cache_examples=False,
99
+ # Removed clear_btn="Clear Chat"
100
+ # Still recommend adding type="messages" to handle the UserWarning if needed
101
+ # type="messages",
102
+ )
103
+
104
+ # --- Launch the App ---
105
+ if __name__ == "__main__":
106
+ chatbot_interface.launch(server_name="0.0.0.0")
prospectus-context.txt ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PASTE THE CLEANED PLAIN TEXT OF YOUR PROSPECTUS HERE
2
+ # Example snippet:
3
+
4
+ About HERE AND NOW AI
5
+ HERE AND NOW AI is India’s leading autonomous Artificial Intelligence Research Institute, dedicated to transforming the way AI is taught, researched, and applied. It is a brainchild of Deepti Balagopal and Ruthran Raghavan, who envisioned a future where AI education is not limited to coders but accessible to every learner — whether they’re from engineering, business, science, or the arts.
6
+ Born from the success of HERE AND NOW – The Language Institute (est. 2011), which redefined language learning in India, HERE AND NOW AI was founded in 2018 with a mission to disrupt traditional education through AI innovation. Our core initiatives lie in:
7
+ * AI Education: Delivering industry-ready, practical AI programs for students
8
+ * Research & Innovation: Exploring cutting-edge LLMs, RAG frameworks, and autonomous agents
9
+ * Automation: Building intelligent systems that power real-world enterprises and academic institutions
10
+ We believe that every college in India can be an AI-powered campus, and we are on a mission to make that happen.
11
+
12
+ Vision & Mission
13
+ Our Vision
14
+ To build a generation of AI-native graduates and researchers empowered with real-world skills and global exposure, through India’s first fully autonomous AI professor.
15
+ Our Mission
16
+ * Deliver AI education to 1 lakh students by 2030
17
+ * Sign MoUs with 100+ colleges for long-term collaboration
18
+ * Build AI as a Service (AIaaS) solutions for corporates using student talent
19
+ * Create open-access tools that empower learners and educators with AI
20
+ HERE AND NOW AI stands for innovation with inclusivity. Whether you're from an arts stream or an engineering background — we are here to level the playing field with AI.
21
+
22
+ Value-Added Courses Overview
23
+ We proudly offer two high-impact AI programs designed for value addition in colleges. These are flexible, certification-backed, and tailored to academic timetables.
24
+
25
+ 1. Business Analytics with AI
26
+ For: Non-technical students – BBA, BCom, BA, BSc, MBA, MCA, ME
27
+ Prerequisites: None
28
+ This course introduces students to the world of data-driven business intelligence through Python, visualization tools, and cutting-edge AI platforms like ChatGPT, Claude, and Gemini.
29
+ Students will learn:
30
+ * How to clean and analyze data using Python
31
+ * How to interpret and visualize insights with Pandas, Matplotlib
32
+ * How AI can enhance decision-making in HR, Finance, Marketing
33
+ * Real-world project: Creating a dashboard or report powered by AI tools
34
+ Why this course matters: In the modern job market, even non-tech graduates are expected to have basic data literacy. This course bridges that gap while giving them an AI edge.
35
+
36
+ 2. Full-Stack AI Developer Program
37
+ For: Technical students – BE, BTech, BCA, MCA, MSc IT, ME
38
+ Prerequisites: Basic familiarity with programming logic
39
+ This project-oriented course teaches students to build AI-powered applications end-to-end using the latest in LLM technology.
40
+ Students will explore:
41
+ * Python fundamentals + API development (Flask, FastAPI)
42
+ * Working with OpenAI, Claude, Gemini through API integration
43
+ * RAG (Retrieval-Augmented Generation), LangChain, Vector DBs
44
+ * Deploying AI apps on cloud platforms (GCP, Vercel)
45
+ * Final Capstone: Build your own AI Chatbot or Assistant
46
+ Why this course matters: Students not only learn AI concepts — they deploy real applications. It builds confidence, improves resumes, and gives them a head start in interviews or internships.
47
+
48
+ Business Analytics with AI: Curriculum
49
+ Total Duration: 30 hours | Mode: Online/Offline/Hybrid
50
+ Eligibility: Any UG/PG student (non-tech or mixed)
51
+ Module Breakdown:
52
+ 1. Getting Started with Python – No coding experience? No problem. We begin at zero.
53
+ 2. Data Analysis with Pandas & NumPy – Learn how to work with datasets, filter and prepare reports
54
+ 3. Data Visualization – Turn raw data into stunning graphs using Matplotlib and Seaborn
55
+ 4. Statistics for Business – Descriptive & Inferential Statistics for smarter decision-making
56
+ 5. AI for Business Users – Use ChatGPT, Copilot, Claude for content, reports, and insights
57
+ 6. Mini Project – Create a business report powered by AI tools
58
+
59
+ Full-Stack AI Developer: Curriculum
60
+ Total Duration: 30 hours | Mode: Project-Based | Eligibility: Tech Background Students
61
+ Module Breakdown:
62
+ 1. Python + Git + IDE Setup – Get started with clean development workflow
63
+ 2. API Development – Build backend endpoints using Flask or FastAPI
64
+ 3. LLM Integration – Learn to work with Gemini, ChatGPT, Claude via API
65
+ 4. LangChain & Vector Databases – Implement memory in AI using RAG
66
+ 5. Cloud Deployment – Launch your app on GCP, Vercel with CI/CD basics
67
+ 6. Capstone Project – Build your own AI product and present it
68
+
69
+ Delivery Format & Certification
70
+ Mode of Delivery:
71
+ * Live Classes (Online or On-Campus)
72
+ * AI-Powered LMS with recordings, quizzes, code labs
73
+ * Mentorship & Peer Discussion Forums
74
+ Certification:
75
+ * Joint Certificate from HERE AND NOW AI + Partner College
76
+ * Certificate includes project link and GitHub portfolio
77
+ Add-Ons:
78
+ * Career Guide PDFs, Resume Templates
79
+ * Code Snippets, Prompt Libraries
80
+ * Exclusive access to internship/freelance opportunities
81
+
82
+ Placement & Career Assistance
83
+ Job Readiness:
84
+ * Business English Training (Add-On)
85
+ * Soft Skills & Interview Prep (Add-On)
86
+ * Resume & LinkedIn Profile Optimization (Free)
87
+ Technical Readiness:
88
+ * GitHub Portfolio Guidance
89
+ * LeetCode Problem Solving (Add-On Module)
90
+ * Mock Interview Rounds
91
+ Network Readiness:
92
+ * LinkedIn Strategy: Personal Branding + Connection Funnels
93
+ * Monthly AI Industry Talk Sessions
94
+
95
+ Leadership Team
96
+ Ruthran RAGHAVAN – CEO & Chief AI Scientist
97
+ Visionary leader and AI educator. Invented the 108-day Business French Immersion Program. Now building India's first Autonomous AI Professor and leading AI evangelism nationwide.
98
+ Deepti BALAGOPAL – COO
99
+ Academic strategist managing operations, course quality, and outreach. She is the backbone of all institutional collaborations and program execution.
100
+ Balaji KAMALAKKANNAN – CTO
101
+ Expert in cloud, open-source LLMs, and full-stack deployment. Balaji leads all technical R&D and product integration for HERE AND NOW AI.
102
+ Gopalakrishnan KANNAN – CMO
103
+ Marketing genius with deep experience in youth outreach and digital campaigns. Gopal ensures the AI movement reaches every corner of India.
104
+
105
+ Contact & Collaboration
106
+ HERE AND NOW AI – Artificial Intelligence Research Institute
107
+ Chennai, Tamil Nadu, India
108
+ Website: www.hereandnowai.com
109
110
+ Phone: +91 99629 61000
111
+ Course Fee Structure:
112
+ * Business Analytics with AI: ₹5,925 / student / semester
113
+ * Full-Stack AI Developer Program: ₹9,925 / student / semester
114
+
115
+ Let’s Build the Future Together
116
+ We look forward to collaborating with your institution. Together, let’s lead India into the AI-powered future.
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ # requirements.txt
2
+ gradio>=4.0.0 # Use a recent version
3
+ google-generativeai>=0.5.0 # Check for latest version
4
+ python-dotenv>=1.0.0