Inspiration: The "Islamic Jarvis"

The idea for Baseerah was born from a personal frustration and a long-held dream. As a student of knowledge (Talib-ul-‘ilm) and a Computer Science student, I constantly felt a gap between my two worlds.

On one side, I had ancient, profound manuscripts (Turath) full of wisdom but difficult to decode without a teacher. On the other side, I had powerful AI tools that felt "corporate," robotic, and disconnected from the etiquette (Adab) required for Islamic study.

I didn't just want a translator. I wanted a companion. I envisioned an "Islamic Jarvis"—a privacy-focused, intelligent research assistant that could look at a page of Ibn Qudamah or Imam Shafi’i, understand the theological arguments, and help me study them deeply. Baseerah is the first step toward that reality.

What it does

Baseerah is not a chatbot; it is a Multimodal Reasoning Engine for classical texts.

  • Visual Manuscript Analysis: Users upload an image of an Arabic manuscript. Baseerah uses Gemini Flash-Latest to read the script, identify the text, and explain the logical connection between the Dalil (evidence) and the Hukm (ruling).
  • Socratic Dialogue: Instead of dumping a lecture, Baseerah enters a "Chat Mode." It acts as a tutor, answering follow-up questions like "Why did the author use this specific Ayah here?"
  • Active Study Tools: It doesn't just explain; it helps you memorize. With one click, users can generate and download Vocabulary Flashcards (CSV), extracting key technical terms, roots, and definitions for use in Anki or Quizlet.

How we built it: The "Scholar's Stack"

We built Baseerah using a "Load-Balanced" architecture to maximize intelligence while respecting resource limits:

  • Frontend: Built with Streamlit for a clean, "Scholar's Desk" UI that separates the manuscript (Sidebar) from the conversation (Center).
  • The Brain (Reasoning): We used Google Gemini Flash-Latest for the core visual analysis and chat. Its multimodal capabilities allow it to "see" the text and understand context instantly.
  • The Tools (Efficiency): We utilized Gemini 1.5 Flash for background tasks like "Vocabulary Extraction." This smart routing prevents the app from crashing due to quota limits while keeping the main chat smart.
  • Prompt Engineering: We used the ROSES Framework (Role, Objective, Scenario, Expected Solution, Steps) to ensure the AI behaves with the Adab (manners) and precision of a scholar, rather than a generic bot.

Challenges we ran into

The journey was a true test of Sabr (patience)!

  • The "Quota War" (Error 429): We constantly hit the API rate limits because we were trying to use the most powerful models for everything. We learned to optimize by downgrading background tasks to lighter models.
  • The "Black Screen of Death": We faced multiple deployment crashes where the app wouldn't load due to hidden file extensions (.env.txt) and missing libraries.
  • Complexity vs. Simplicity: We originally tried to build a real-time Voice AI, but it became buggy and robotic. We had to make the hard decision to "kill" the feature to save the user experience, focusing instead on a polished Text & Study interface.

Accomplishments that we're proud of

  • The "Flashcard" Engine: We successfully used JSON mode to turn unstructured theology text into structured data tables that students can actually download.
  • The Persona: We managed to tune the system prompt so that Baseerah sounds like a "Brotherly Tutor"—warm, serious, and academically rigorous, rather than a robot saying "Asterisk Asterisk."
  • Deployment: Going from a broken script on a local drive to a live, deployed web app in under 4 days.

What we learned

  • Load Balancing: We learned that "One Model Fits All" is a bad strategy. Using different AI models for different tasks (Reasoning vs. Extraction) is key to a stable app.
  • Constraint is Creativity: The strict hackathon deadline forced us to cut "cool" features (like voice) to perfect "useful" features (like flashcards).
  • Adab in AI: We learned that how an AI speaks is just as important as what it says, especially in the context of faith.

What's next for Baseerah

  • PDF Support: Allowing students to upload entire books, not just single pages.
  • Voice Mode v2: Implementing a proper, human-sounding "Gemini Live" integration for hands-free study while driving.
  • Personal Knowledge Base: Allowing Baseerah to "remember" what you studied last week, truly becoming the "Islamic Jarvis" that grows with you.

Built With

Share this project:

Updates