# Configuration settings for the Hugging Face Model Deployer import os from typing import Dict, Any # App Configuration APP_CONFIG = { "title": "Hugging Face Model Deployer", "description": "Complete guide to deploy your models with real TTS/STT integration", "version": "1.0.0", "author": "Hugging Face Deployer Team" } # Hugging Face API Configuration HF_CONFIG = { "base_url": "https://huggingface.co", "api_url": "/static-proxy?url=https%3A%2F%2Fapi-inference.huggingface.co", "inference_endpoint_url": "https://api.endpoints.huggingface.cloud" } # Default Model Settings DEFAULT_MODELS = { "text-generation": [ "microsoft/DialoGPT-medium", "facebook/opt-125m", "EleutherAI/gpt-neo-125m" ], "text2text-generation": [ "google/flan-t5-small", "facebook/bart-large-cnn" ], "text-to-speech": [ "microsoft/speecht5_tts", "facebook/tts_transformer-en-ljspeech" ], "automatic-speech-recognition": [ "openai/whisper-tiny", "facebook/wav2vec2-base-960h" ] } # Deployment Settings DEPLOYMENT_CONFIG = { "default_hardware": "cpu", "default_scale": 1, "default_task": "text-generation", "max_retries": 3, "timeout": 300, # 5 minutes "polling_interval": 10 # 10 seconds } # UI Settings UI_CONFIG = { "theme": "soft", "css_file": "styles.css", "max_file_size": "200MB", "show_tips": True, "auto_save": True } # Tutorial Content TUTORIAL_STEPS = [ { "title": "Authentication", "description": "Connect to your Hugging Face account", "code": """ from huggingface_hub import login # Login with your token login(token="your_token_here") """ }, { "title": "Model Selection", "description": "Choose or create a model to deploy", "code": """ from huggingface_hub import HfApi api = HfApi() models = list(api.list_models(author="your_username")) """ }, { "title": "Deployment", "description": "Deploy your model to production", "code": """ endpoint = api.create_inference_endpoint( name="my-endpoint", model="your-username/your-model", task="text-generation" ) """ }, { "title": "Testing", "description": "Test your deployed model", "code": """ import requests response = requests.post( endpoint_url, headers={"Authorization": f"Bearer {token}"}, json={"inputs": "Hello!"} ) """ }, { "title": "TTS/STT Integration", "description": "Add voice capabilities to your model", "code": """ from transformers import pipeline tts = pipeline("text-to-speech", model="microsoft/speecht5_tts") stt = pipeline("automatic-speech-recognition", model="openai/whisper-tiny") """ } ] # Error Messages ERROR_MESSAGES = { "auth_failed": "Authentication failed. Please check your token.", "model_not_found": "Model not found. Please check the model ID.", "deployment_failed": "Deployment failed. Please try again.", "endpoint_error": "Endpoint error. Please check the URL and try again.", "network_error": "Network error. Please check your connection.", "permission_denied": "Permission denied. Please check your token permissions." } # Success Messages SUCCESS_MESSAGES = { "auth_success": "Successfully authenticated!", "deployment_success": "Model deployed successfully!", "model_created": "Model repository created!", "upload_success": "Files uploaded successfully!", "endpoint_ready": "Endpoint is ready for use!" } # Environment Variables ENV_VARS = [ "HF_TOKEN", "HF_USERNAME", "SPACE_ID", "GRADIO_SERVER_NAME", "GRADIO_SERVER_PORT" ] # Feature Flags FEATURES = { "gpu_support": True, "model_upload": True, "voice_chat": True, "monitoring": True, "advanced_settings": True }