ml_assistant / README.md
Mateo4's picture
Update README.md
ecff91c verified

A newer version of the Gradio SDK is available: 6.5.1

Upgrade
metadata
license: mit
title: ML Assistanct
sdk: gradio
emoji: 📚
colorFrom: gray
colorTo: green
short_description: This is ML Assistant for Machine Learning Course of Soleyman

Gemini RAG Chatbot for ML Theory

This Hugging Face Space hosts a Retrieval-Augmented Generation (RAG) chatbot designed for Machine Learning theory. It allows you to upload your own PDF documents, and then ask questions about their content. The chatbot utilizes Google's Gemini API for language generation and Sentence Transformers with FAISS for efficient document retrieval.

How to Use

  1. Set up your GEMINI_API_KEY:

    • Go to your Space on Hugging Face.
    • Navigate to the "Settings" tab.
    • Scroll down to "Space secrets".
    • Add a new secret with the name GEMINI_API_KEY and paste your actual Google Gemini API key as its value. This is crucial for the app to function.
  2. Upload Documents:

    • Once the app loads, use the "Upload PDF Documents" button on the interface.
    • Select one or more PDF files containing the Machine Learning theory content you want the chatbot to reference.
    • The app will process these documents, extract text, embed it, and build an internal knowledge base.
  3. Ask Questions:

    • After the documents are successfully processed (check the "Upload Status" textbox), type your questions related to the uploaded content into the chat interface.
    • The chatbot will retrieve relevant information from your documents and use the Gemini model to formulate an answer.

Technical Details

  • Large Language Model (LLM): models/gemini-2.0-flash (provided by Google Gemini API)
  • Embedding Model: all-MiniLM-L6-v2 (from Sentence Transformers, for converting text into numerical vectors)
  • Vector Database: FAISS (for efficient similarity search of document embeddings)
  • Framework: Gradio (for the interactive web interface)
  • Document Processing: PyMuPDF (for extracting text from PDF files)

Dependencies

The core Python dependencies for this application are listed in requirements.txt:

  • faiss-cpu
  • PyMuPDF
  • google-generativeai
  • sentence-transformers
  • numpy
  • gradio