broadfield-dev commited on
Commit
8460194
·
verified ·
1 Parent(s): bd49611

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +56 -61
README.md CHANGED
@@ -9,69 +9,61 @@ app_file: app.py
9
  pinned: false
10
  ---
11
 
12
- Below is detailed documentation for the Assembler Space API, designed to be clear and precise for another LLM (or human developer) to understand and use effectively. It covers the API’s purpose, endpoints, request format, response structure, examples, and considerations.
13
- Assembler Space API Documentation
14
- Overview
15
- The Assembler Space is a Hugging Face Space that acts as a factory for creating new Hugging Face Spaces dynamically. It exposes a Flask-based API that accepts JSON input containing code, files, parameters, and configuration details. Upon receiving a valid request, it creates a new Space repository on Hugging Face, populates it with the provided files, and triggers its deployment. The API supports multiple Space types (e.g., gradio, static, docker, streamlit) and multi-file submissions, making it versatile for generating a wide range of applications.
 
 
 
16
  The Assembler Space itself runs as a Docker-based Space on Hugging Face, accessible via a public URL once deployed.
17
- Base URL
 
18
  The API is hosted at:
19
  https://<your-username>-assembler.hf.space/create-space
20
- Replace <your-username> with the Hugging Face username hosting the Assembler Space. The exact URL will be provided once the Space is deployed.
21
- Endpoint
22
- POST /create-space
 
23
  Creates a new Hugging Face Space based on the provided JSON payload.
24
- Request Format
25
- Method: POST
26
- Content-Type: application/json
27
- Body: A JSON object with the following fields:
28
- Field
29
- Type
30
- Required
31
- Description
32
- space_type
33
- String
34
- No
35
- The type of Space to create. Options: gradio, static, docker, streamlit. Defaults to gradio if omitted.
36
- files
37
- Object
38
- Yes
39
- A dictionary where keys are filenames (e.g., app.py, index.html) and values are file contents as strings.
40
- parameters
41
- Object
42
- No
43
- A dictionary of key-value pairs to be injected into Python files as PARAMS or used by the generated Space’s code.
44
- Request Constraints
45
- At least one file must be provided in files.
46
- Filenames in files should include extensions (e.g., .py, .html, .css, .txt) to ensure correct handling.
47
- space_type must match one of the supported values, or the request will fail.
48
- File contents should be valid for the intended space_type (e.g., Python code for gradio or docker, HTML for static).
49
- Response Format
50
- Content-Type: application/json
51
- Status Codes:
52
- 200 OK: Space creation succeeded.
53
- 400 Bad Request: Invalid JSON or missing/invalid fields.
54
- 500 Internal Server Error: Unexpected error during Space creation.
55
- Body: A JSON object with the following fields:
56
- Field
57
- Type
58
- Description
59
- message
60
- String
61
- A brief status message (e.g., "New Space created").
62
- url
63
- String
64
- The URL of the newly created Space (e.g., https://huggingface.co/spaces/<username>/<space-name>).
65
- note
66
- String
67
- Additional information (e.g., deployment time warning).
68
- error
69
- String
70
- (Only in error responses) Description of what went wrong.
71
- Example Requests and Responses
72
- Example 1: Static Space
73
- Request:
74
- json
75
  {
76
  "space_type": "static",
77
  "files": {
@@ -83,7 +75,7 @@ json
83
  }
84
  }
85
  Response (200 OK):
86
- json
87
  {
88
  "message": "New Space created",
89
  "url": "https://huggingface.co/spaces/your-username/GeneratedSpace-abc123",
@@ -187,4 +179,7 @@ Limitations
187
  Rate Limits: Hugging Face may restrict frequent Space creation. Check their API documentation for quotas.
188
  File Size: Large files may fail to upload; keep contents reasonable (e.g., <1MB per file).
189
  Error Handling: Basic validation is included, but complex syntax checking isn’t performed.
190
- This documentation should equip another LLM or developer to use the Assembler Space API correctly. Let me know if you’d like to expand any section or add more examples!
 
 
 
 
9
  pinned: false
10
  ---
11
 
12
+ Here’s the Assembler Space API documentation rewritten in a Markdown code block, suitable for pasting into a Markdown file or passing to another LLM while preserving formatting.
13
+ markdown
14
+ # Assembler Space API Documentation
15
+
16
+ ## Overview
17
+ The **Assembler Space** is a Hugging Face Space that acts as a factory for creating new Hugging Face Spaces dynamically. It exposes a Flask-based API that accepts JSON input containing code, files, parameters, and configuration details. Upon receiving a valid request, it creates a new Space repository on Hugging Face, populates it with the provided files, and triggers its deployment. The API supports multiple Space types (e.g., `gradio`, `static`, `docker`, `streamlit`) and multi-file submissions, making it versatile for generating a wide range of applications.
18
+
19
  The Assembler Space itself runs as a Docker-based Space on Hugging Face, accessible via a public URL once deployed.
20
+
21
+ ## Base URL
22
  The API is hosted at:
23
  https://<your-username>-assembler.hf.space/create-space
24
+ Replace `<your-username>` with the Hugging Face username hosting the Assembler Space. The exact URL will be provided once the Space is deployed.
25
+
26
+ ## Endpoint
27
+ ### `POST /create-space`
28
  Creates a new Hugging Face Space based on the provided JSON payload.
29
+
30
+ #### Request Format
31
+ - **Method**: `POST`
32
+ - **Content-Type**: `application/json`
33
+ - **Body**: A JSON object with the following fields:
34
+
35
+ | Field | Type | Required | Description |
36
+ |--------------|----------|----------|-----------------------------------------------------------------------------|
37
+ | `space_type` | String | No | The type of Space to create. Options: `gradio`, `static`, `docker`, `streamlit`. Defaults to `gradio` if omitted. |
38
+ | `files` | Object | Yes | A dictionary where keys are filenames (e.g., `app.py`, `index.html`) and values are file contents as strings. |
39
+ | `parameters` | Object | No | A dictionary of key-value pairs to be injected into Python files as `PARAMS` or used by the generated Space’s code. |
40
+
41
+ #### Request Constraints
42
+ - At least one file must be provided in `files`.
43
+ - Filenames in `files` should include extensions (e.g., `.py`, `.html`, `.css`, `.txt`) to ensure correct handling.
44
+ - `space_type` must match one of the supported values, or the request will fail.
45
+ - File contents should be valid for the intended `space_type` (e.g., Python code for `gradio` or `docker`, HTML for `static`).
46
+
47
+ #### Response Format
48
+ - **Content-Type**: `application/json`
49
+ - **Status Codes**:
50
+ - `200 OK`: Space creation succeeded.
51
+ - `400 Bad Request`: Invalid JSON or missing/invalid fields.
52
+ - `500 Internal Server Error`: Unexpected error during Space creation.
53
+ - **Body**: A JSON object with the following fields:
54
+
55
+ | Field | Type | Description |
56
+ |-----------|--------|-----------------------------------------------------------------------------|
57
+ | `message` | String | A brief status message (e.g., `"New Space created"`). |
58
+ | `url` | String | The URL of the newly created Space (e.g., `https://huggingface.co/spaces/<username>/<space-name>`). |
59
+ | `note` | String | Additional information (e.g., deployment time warning). |
60
+ | `error` | String | (Only in error responses) Description of what went wrong. |
61
+
62
+ #### Example Requests and Responses
63
+
64
+ ##### Example 1: Static Space
65
+ **Request:**
66
+ ```json
 
 
 
 
 
 
 
 
 
 
 
 
 
67
  {
68
  "space_type": "static",
69
  "files": {
 
75
  }
76
  }
77
  Response (200 OK):
78
+
79
  {
80
  "message": "New Space created",
81
  "url": "https://huggingface.co/spaces/your-username/GeneratedSpace-abc123",
 
179
  Rate Limits: Hugging Face may restrict frequent Space creation. Check their API documentation for quotas.
180
  File Size: Large files may fail to upload; keep contents reasonable (e.g., <1MB per file).
181
  Error Handling: Basic validation is included, but complex syntax checking isn’t performed.
182
+
183
+ ---
184
+
185
+ This Markdown code block preserves the structure and formatting, making it easy to share or render in a Markdown viewer. You can copy this directly into a `.md` file or pass it to another LLM for further processing. Let me know if you need any adjustments!