CoolFace
Apppublic

khoaliamle/Cooking_Tutor

sourceHugging Faceapache-2.0updated 11mo agoView on Hugging Face
0likes
App README

Cooking Tutor Backend

An intelligent cooking assistant that provides personalized recipe guidance, cooking techniques, and culinary tips with multilingual support (English, Vietnamese, Chinese).

πŸš€ Features

  • β€”Smart Recipe Recommendations: Get personalized recipes based on available ingredients
  • β€”Multilingual Support: English, Vietnamese (TiαΊΏng Việt), and Chinese (δΈ­ζ–‡)
  • β€”Cooking Techniques: Step-by-step guidance for various cooking methods
  • β€”Ingredient Substitutions: Smart suggestions for ingredient alternatives
  • β€”Dietary Accommodations: Support for various dietary preferences and restrictions
  • β€”Web Search Integration: Real-time cooking information from trusted sources
  • β€”Memory System: Contextual conversation continuity

πŸ› οΈ Technical Stack

  • β€”Backend: FastAPI with Python 3.9+
  • β€”AI Models: Google Gemini Flash API
  • β€”Memory: FAISS + Sentence Transformers for semantic search
  • β€”Translation: HuggingFace Transformers (VietAI/envit5-translation, Helsinki-NLP/opus-mt-zh-en)
  • β€”Web Search: DuckDuckGo + specialized cooking engines
  • β€”Deployment: Docker container on HuggingFace Spaces

πŸƒβ€β™‚οΈ Quick Start

The API is automatically deployed and running on HuggingFace Spaces. You can interact with it through the web interface or API endpoints.

API Endpoints

  • β€”GET / - Health check
  • β€”POST /chat - Main chat endpoint
  • β€”GET /health - System health status

Example Usage

python
import requests

# Chat with the cooking tutor
response = requests.post("https://your-space-url.hf.space/chat", json={
    "user_id": "user123",
    "query": "How do I make perfect pasta?",
    "lang": "EN"
})

print(response.json())

🌍 Multilingual Support

The cooking tutor supports three languages:

  • β€”English (EN): Full feature support
  • β€”Vietnamese (VI): Complete Vietnamese language support
  • β€”Chinese (ZH): Simplified Chinese support

πŸ”§ Environment Variables

Required environment variables for deployment:

bash
FlashAPI=your_gemini_api_key

πŸ“š API Documentation

Chat Endpoint

POST /chat

Request body:

json
{
    "user_id": "string",
    "query": "string",
    "lang": "EN|VI|ZH",
    "search_mode": true,
    "video_mode": false,
    "servings": 4,
    "dietary": ["vegetarian"],
    "allergens": ["nuts"],
    "equipment": ["oven", "stovetop"],
    "time_limit_minutes": 30,
    "skill_level": "beginner|intermediate|advanced",
    "cuisine": "italian",
    "structured": false
}

Response:

json
{
    "response": "string",
    "videos": [
        {
            "title": "string",
            "url": "string",
            "thumbnail": "string",
            "source": "string"
        }
    ]
}

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Frontend      β”‚    β”‚   FastAPI        β”‚    β”‚   AI Models     β”‚
β”‚   (Vercel)      │◄──►│   Backend        │◄──►│   (Gemini)      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                              β”‚
                              β–Ό
                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                       β”‚   Search &       β”‚
                       β”‚   Memory         β”‚
                       β”‚   Systems        β”‚
                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸ” Search & Memory

  • β€”Web Search: Real-time cooking information from multiple sources
  • β€”Memory Management: Short-term and long-term memory for conversation context
  • β€”Content Processing: Advanced content extraction and summarization
  • β€”Citation System: Proper source attribution with inline citations

πŸš€ Deployment

This space is configured for Docker deployment on HuggingFace Spaces:

  • β€”Port: 7860
  • β€”Base Image: Python 3.9
  • β€”Auto-deploy: Enabled on push to main branch

πŸ“„ License

MIT License - see LICENSE file for details.

🀝 Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.

πŸ“ž Support

For support or questions, please open an issue in the repository.