Lab — Publish a Gemma model API on HuggingFace Spaces with Google Auth#
Objective#
Deploy a text generation API using a local LLM framework (like Ollama or transformers) to Hugging Face Spaces, and protect the endpoint using Google OAuth.
Requirements#
- Create a FastAPI application that serves a generation endpoint (e.g.,
/generate). - Integrate Google OAuth 2.0 so that only authenticated users can access the endpoint.
- Containerize the application using Docker.
- Deploy the Docker container to a Hugging Face Space.
Deliverables#
- Link to your Hugging Face Space.
- The
Dockerfileandmain.pycode. - A brief explanation of how you configured the OAuth credentials.