Introduction
What is Abyss?
Abyss is a platform for creating, deploying, and sharing Python-based AI Widgets. These Widgets can perform specific tasks, solve problems, or leverage AI models (such as GPT-4, Claude 3.5, or NIMs). Whether you're an AI enthusiast or a developer, Abyss simplifies the process, allowing you to create or use these powerful tools easily.
What are AI Widgets?
AI Widgets are compact applications designed to solve specific problems. They run on Python, optionally integrating AI models, and offer a user-friendly interface for input and output. No prompt engineering or deep technical knowledge is required to use them—just fill in the necessary fields or upload files, then run!
Who can use them?
Absolutely anyone! Widgets on Abyss don’t require any prompt engineering or technical knowledge! Simply fill the required inputs and/or upload necessary files and click Run.
How are AI Widgets built?
Users with Python skills can easily create user-friendly Widgets by uploading their Python projects and layering an interface with the platform’s tools. Abyss handles deployment, making your Widget accessible to others.
Setting Up Your Python Project for Abyss
To create a successful Widget, ensure your Python project meets the following criteria:
1. Key Files in Your Project
run.py
(Entry Point): This file must be in the root directory. It serves as the main script that will be executed when the Widget runs. Example:import os def main(): input_value = os.environ.get('input_value', 'default_value') result = perform_task(input_value) with open('output/result.txt', 'w') as f: f.write(result) if __name__ == "__main__": main()
requirements.txt
(Python Dependencies): List all Python packages your project needs in this file. For example:openai==0.27.0 numpy==1.23.0
requirements.system
(System-Level Dependencies): If your Widget needs system-level packages, list them here. For example:texlive poppler-utils
This ensures your project has all apt packages it needs to run smoothly.output
folder: Your project must include anoutput
folder in the root directory where all generated files should be placed. These files will be passed back to the user. Even if your Widget doesn’t generate complex files, include a “receipt” or a friendly message as output.
2. Input and Output Handling
- Input: Environment variables handle inputs. For example, use os.environ.get() to access data passed via a generated.
# Example input handling user_input = os.environ.get('user_input')
- Output: All output files should be placed in the output folder. This is crucial for the Widget to return results to the user.
# Example output handling with open('output/message.txt', 'w') as f: f.write("Task completed successfully!")
3. Memory and Compute Limits
- Memory: Your project must use 512 MB or less. (Larger memory support is planned for future updates.)
- Python Version: Ensure compatibility with Python 3.10.
- Compute: Your project must use no more than 4 vCPUs and 4 GB RAM.
Creating the Interface
When creating your Widget, you will also design a simple interface for users to interact with. Abyss provides a range of input field types:
- Text Field: A single-line input field for short text entries. Ideal for brief information.First name
- Text Area: A multi-line input field for longer text entries. Suitable for detailed information.Comment
- Number Field: Perfect for quantities, measurements, or any data that requires numeric input.Width
- Radio Group: A set of radio buttons where users can select only one option from a predefined list. Useful for single-choice questions.Favorite pet
- Checkbox: A versatile input, which allows users to select one or multiple options from a list. Making it suitable for both single and multiple-choice questions. such as selecting hobbies or preferences.Favorite sports
- Select: A dropdown menu where users can choose one option from a list. This is useful for selecting items from a long list without cluttering the interface.Ice cream flavor
- Date: An input field for selecting a date. Users can pick day/month/year conveniently.Event datemmddyyyy
- File: An input area that allows users to upload a file. You can specify the accepted file extensions (e.g.,
.pdf
,.docx
) to ensure users upload the correct file type.Setting Up the File Input:- When creating the file input field in your Widget's interface, you must specify the file name (excluding the extension). This name determines how the uploaded file will be saved in your Widget's execution environment.
- Example: If you specify the file name as
data
, and a user uploads a file namedresume.pdf
, the file will be saved in your Widget's environment asdata.pdf
.
These fields make it easy for users to provide data your Widget needs.
Testing, Deployment, and Sharing
1. Test Your Widget
After creating your Widget and setting up the interface, you must “TEST RUN WIDGET” to ensure everything works as expected. This includes verifying that inputs are handled correctly, the output is generated in the output
folder, your widget doesn't encounter a Python error, and your project doesn't exceed memory or compute limits.
2. Share and Deploy
During deployment, you'll share an example output for users from your successful “TEST RUN” to demonstrate what your Widget does. Once deployed, it becomes live and ready for use by others.
Editing and Updating Your Widget
If you need to make changes to your Widget:
- Reactivation: Any changes to the Python project or the interface will require a reactivation test. Once the changes pass the test, you will need to “share and deploy” the new version.
Common Errors and Debugging
Here are some common errors users face and how to troubleshoot them:
- Missing Dependencies: Double-check your
requirements.txt
andrequirements.system
files to ensure all necessary packages are listed. - No Output Generated: Ensure your project is writing output files to the
output
folder. The Widget needs at least one file to return to the user. - Memory Exceeded: Ensure your project’s memory footprint is under 512 MB. Consider optimizing or reducing unnecessary operations.
Examples and Code Snippets
Basic Widget Example
Here’s a basic Widget that takes user input, processes it, and returns a result:
import os def main(): user_input = os.environ.get('user_input', 'default_input') result = f"You entered: {user_input}" with open('output/result.txt', 'w') as f: f.write(result) if __name__ == "__main__": main()
Make sure your requirements.txt
includes all necessary libraries and your run.py
file is in the root folder. Your python project can of course have multiple Python files, the run.py
file will just serve as the entry point for Widget execution.