跳到主要内容

Space User Guide

AtomGit Space is a powerful online application deployment and sharing platform that allows you to easily turn AI models into interactive web applications. This guide will help you understand how to create and manage Spaces.

Creating a Space

Creating a New Space

  1. Log in to your AtomGit account
  2. Click "+" in the top right corner > "New Space"
  3. Fill in the basic information:
    • space ID
    • Space name
    • Space description
    • license
  4. Choose the Space SDK type:
    • Gradio
    • Static
  5. Configure hardware resources:
    • CPU
    • Memory
    • GPU (if needed)
  6. Choose the image version
  7. Set visibility
  8. Click "Create" to complete

Space Configuration File

Create a space-config.yaml file to define the 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
  1. Enter keywords in the search box
  2. Filter by space category:
    • Generation & Creation
    • Dialogue Systems
    • Text Processing
    • Multimodal
    • Image Processing
    • Speech Technology
    • Data Analysis
    • Intelligent Learning
    • Intelligent Automation

Space Activation

Through Web Interface

  1. Go to the Space details page
  2. Click the "Activate" button
  3. Choose deployment configuration:
    • Instance type
    • Auto-scaling settings
    • Environment variables

Using a Space

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

  1. Application Development

    • Use responsive design
    • Add error handling
    • Optimize loading performance
    • Provide user guides
  2. Resource Management

    • Configure resources properly
    • Use caching mechanisms
    • Monitor resource usage
    • Set auto-scaling
  3. Security

    • Input validation
    • Access control
    • Data encryption
    • Logging
  4. Maintenance and Updates

    • Version control
    • Automated testing
    • Monitoring and alerts
    • Regularly update dependencies

Frequently Asked Questions

Q: What programming languages does Space support?

A: It mainly supports Python, and other languages can be supported through Docker.

Q: How to handle performance issues of Space?

A: You can improve performance by optimizing code, using caching, and adjusting resource configurations.

Q: How to achieve automatic updates for Space?

A: You can configure GitHub Actions or use AtomGit CI/CD for automatic deployment.

Q: What are the access restrictions for Space?

A: Free accounts have limits on monthly traffic and computing resources. Please check the pricing page for specific restrictions.