Space Usage Guide
GitCode AI Space is a powerful online application deployment and sharing platform that allows you to easily transform AI models into interactive web applications. This guide will help you understand how to create and manage Spaces.
Space Creation
Create New Space
- Login to your GitCode AI account
- Go to “Space” > “Create Space”
- Fill in basic information:
- Space name
- Description
- Tags
- Visibility settings
- Select Space type:
- Gradio application
- Streamlit application
- Docker container
- Static website
- Configure hardware resources:
- CPU
- Memory
- GPU (if needed)
- Click “Create” to complete
[Image: Space creation page screenshot]
Space Configuration File
Create a space-config.yaml
file to define Space configuration:
space-name: my-awesome-app
version: 1.0.0
sdk: gradio
python_version: "3.9"
requirements:
- gradio>=3.50.0
- torch>=2.0.0
resources:
cpu: 1
memory: 2GB
gpu: null
Space Search
Quick Search
- Enter keywords in the search box
- Use filters:
- Application type
- Framework
- Resource requirements
- Access volume
- Update time
Space Activation
Through Web Interface
- Go to Space details page
- Click “Activate” button
- Select deployment configuration:
- Instance type
- Auto-scaling settings
- Environment variables
Space Usage
Development Mode
import gradio as gr
def greet(name):
return f"Hello {name}!"
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
# Local development
demo.launch()
# Deploy to Space
demo.deploy()
Docker Deployment
FROM python:3.9-slim
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 7860
CMD ["python", "app.py"]
Environment Variable Configuration
# Set environment variables
export MODEL_PATH=/path/to/model
export API_KEY=your-api-key
# Use environment variables
import os
model_path = os.getenv("MODEL_PATH")
Best Practices
Application Development
- Use responsive design
- Add error handling
- Optimize loading performance
- Provide user guides
Resource Management
- Reasonably configure resources
- Use caching mechanisms
- Monitor resource usage
- Auto-scaling settings
Security
- Input validation
- Access control
- Data encryption
- Logging
Maintenance Updates
- Version control
- Automated testing
- Monitoring alerts
- Regular dependency updates
Common Questions
Q: What programming languages does Space support?
A: Mainly supports Python, while other languages can be supported through Docker.
Q: How to handle Space performance issues?
A: Performance can be improved by optimizing code, using caching, adjusting resource configuration, etc.
Q: How to implement automatic Space updates?
A: You can configure GitHub Actions or use GitCode CI/CD for automatic deployment.
Q: What are Space access limitations?
A: Free accounts have monthly access volume and computing resource limitations. Please check the pricing page for specific limits.