Skip to content

itzsudipta/GemmaLangServeAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

🚀 GemmaLangServeAPI

GemmaLangServeAPI is a FastAPI-powered API service built using Google's Gemma 2B LLM integrated through LangChain and LangServe. It allows users to submit Python code and receive human-like explanations in response — ideal for educational, debugging, or AI-assistance use cases.

Hosted via ngrok for easy sharing and accessible testing through Postman.


📌 Features

  • 🧠 Explains Python functions in natural language
  • 🔗 Easily deployable via FastAPI + LangServe
  • ⚡ Supports Hugging Face Gemma 2B model pipeline
  • 🧪 API testing-ready via Postman or Swagger UI
  • ☁️ Hosted via Google Colab with public URL through ngrok

🛠️ Tech Stack

Layer Technology / Tool
API Framework FastAPI
LLM Gemma 2B by Google
Model Pipeline HuggingFace Transformers
Orchestration LangChain + LangServe
Serving Uvicorn
Tunneling ngrok
LLM Wrapper HuggingFacePipeline
Test Tool Postman
Platform Google Colab

🚀 How to Run

🧱 Prerequisites

Install dependencies:

pip install fastapi uvicorn transformers langchain langserve langchain_huggingface huggingface_hub pyngrok nest_asyncio

▶️ Run the Server

python app.py

You’ll get a public URL via ngrok, like:

🔗 https://your-subdomain.ngrok-free.app/docs

Open the /docs route to explore Swagger UI or test it using Postman.


📮 Postman API Guide

Method Endpoint Description
POST /explain Submit Python code for explanation

🧾 Headers

Content-Type: application/json

📤 Request Body

{
  "code": "def add(a, b): return a + b"
}

✅ Example Response

{
  "output": "This function takes two parameters and returns their sum."
}

🧩 Project Structure

GemmaLangServeAPI/
├── app.py            # FastAPI + LangChain setup
├── requirements.txt  # All dependencies
└── README.md         # You're reading it!

📚 Use Cases

  • 👨‍💻 Educational tools or tutorials
  • 🧠 AI-powered code explanation service
  • 🤖 Backend service for developer assistance tools

📝 License

This project is licensed under the MIT License.


🙏 Acknowledgements

  • 🤖 Google AI – Gemma LLM
  • 🧱 LangChain
  • 🤗 Hugging Face
  • ⚡ FastAPI

About

GemmaLangServeAPI is a FastAPI-based API service that leverages Google’s Gemma 2B language model via Hugging Face Transformers and LangChain. It provides a /explain endpoint for code explanation, supports easy deployment with ngrok, and is ideal for educational, debugging, or AI-assistance use cases.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages