{"id":14065622,"url":"https://github.com/abraham-ai/eden","last_synced_at":"2025-10-23T20:30:23.054Z","repository":{"id":35818903,"uuid":"378241991","full_name":"abraham-ai/eden","owner":"abraham-ai","description":"Eden converts your python function into a hosted endpoint with minimal changes to your existing code :mage_man:","archived":false,"fork":false,"pushed_at":"2023-03-12T20:46:02.000Z","size":821,"stargazers_count":47,"open_issues_count":6,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-30T20:43:33.101Z","etag":null,"topics":["celery","cuda","fastapi","python","redis-client","task-queue"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/abraham-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-18T19:01:41.000Z","updated_at":"2024-05-13T18:36:59.000Z","dependencies_parsed_at":"2024-05-28T01:50:49.495Z","dependency_job_id":null,"html_url":"https://github.com/abraham-ai/eden","commit_stats":{"total_commits":232,"total_committers":6,"mean_commits":"38.666666666666664","dds":"0.19396551724137934","last_synced_commit":"04b6b3de056f79afbdbdf1d8fa129ffb97f190f8"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abraham-ai%2Feden","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abraham-ai%2Feden/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abraham-ai%2Feden/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/abraham-ai%2Feden/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/abraham-ai","download_url":"https://codeload.github.com/abraham-ai/eden/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237882172,"owners_count":19381176,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["celery","cuda","fastapi","python","redis-client","task-queue"],"created_at":"2024-08-13T07:04:35.932Z","updated_at":"2025-10-23T20:30:17.572Z","avatar_url":"https://github.com/abraham-ai.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# Eden\n\n[![tests](https://github.com/abraham-ai/eden/actions/workflows/main.yml/badge.svg)](https://github.com/abraham-ai/eden/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/abraham-ai/eden/branch/master/graph/badge.svg?token=83QZRAE4XS)](https://codecov.io/gh/abraham-ai/eden)\n\n\u003cimg src = \"https://raw.githubusercontent.com/abraham-ai/eden/master/images/cover.png\"\u003e\n\n\u003e You were in Eden, the garden of God. Every kind of precious stone adorned you: ruby, topaz, and diamond, beryl, onyx, and jasper, sapphire, turquoise, and emerald. Your mountings and settings were crafted in gold, prepared on the day of your creation.\n\u003e\n\u003e Ezekiel 28:13\n\nEden helps you to deploy your AI art pipelines (or sometimes other stuff) as a hosted endpoint with support for multiple GPUs and scaling over multiple machines. If you're new here, check out the [examples](https://github.com/abraham-ai/eden#examples)\n\n```\npip install eden-python\n```\n\n## Setting up a block\n\nHosting with `eden` requires minimal changes to your existing code. Each unit within `eden` is called a `Block`, they're the units which take certain inputs and generate art accordingly.\n\nThe first step is to configure `run()`.\n\n```python\nfrom eden.block import Block\nfrom eden.datatypes import Image\n\neden_block = Block()\n```\n\n`run()` is supposed to be the function that runs every time someone wants to use this pipeline to generate art. For now it supports text, images, and numbers as inputs.\n\n```python\nmy_args = {\n        'prompt': 'let there be light', ## text\n        'number': 12345,                ## numbers\n        'input_image': Image()          ## images require eden.datatypes.Image()\n    }\n\n@eden_block.run(args = my_args)\ndef do_something(config):\n\n    pil_image = config['input_image']\n    some_number = config['number']\n\n    return {\n        'text': 'hello world',  ## returning text\n        'number': some_number,       ## returning numbers\n        'image': Image(pil_image)    ## Image() works on PIL.Image, numpy.array and on jpg an png files (str)\n    }\n```\n\n## Hosting a block\n\n```python\nfrom eden.hosting import host_block\n\nhost_block(\n    block = eden_block,\n    port= 5656,\n    logfile= 'logs.log',\n    log_level= 'info',\n    max_num_workers = 5\n)\n```\n\n- `block` (`eden.block.Block`): The eden block you'd want to host.\n- `port` (`int, optional`): Localhost port where the block would be hosted. Defaults to `8080`.\n- `host` (`str`): specifies where the endpoint would be hosted. Defaults to `'0.0.0.0'`.\n- `max_num_workers` (`int, optional`): Maximum number of tasks to run in parallel. Defaults to `4`.\n- `redis_port` (`int, optional`): Port number for celery's redis server. Defaults to `6379`.\n- `redis_host` (`str, optional`): Place to host redis for `eden.queue.QueueData`. Defaults to `\"localhost\"`.\n- `requires_gpu` (`bool, optional`): Set this to `False` if your tasks dont necessarily need GPUs.\n- `log_level` (`str, optional`): Can be 'debug', 'info', or 'warning'. Defaults to `'warning'`\n- `exclude_gpu_ids` (`list, optional`): List of gpu ids to not use for hosting. Example: `[2,3]`. Defaults to `[]`\n- `logfile`(`str, optional`): Name of the file where the logs would be stored. If set to `None`, it will show all logs on stdout. Defaults to `'logs.log'`\n- `queue_name`(`str, optional`): Name of the celery queue used for the block. Useful when hosting multiple blocks with the same redis. (defaults on `celery`)\n\n## Client\n\nA `Client` is the unit that sends requests to a hosted block.\n\n```python\nfrom eden.client import Client\nfrom eden.datatypes import Image\n\nc = Client(url = 'http://127.0.0.1:5656', username= 'abraham')\n```\n\nAfter you start a task with `run()` as shown below, it returns a token as `run_response['token']`. This token should be used later on to check the task status or to obtain your results.\n\n\u003e **Note**: `Image()` is compatible with following types: `PIL.Image`, `numpy.array` and filenames (`str`) ending with `.jpg` or `.png`\n\n```python\nconfig = {\n    'prompt': 'let there be light',\n    'number': 2233,\n    'input_image': Image('your_image.png')  ## Image() supports jpg, png filenames, np.array or PIL.Image\n}\n\nrun_response = c.run(config)\n```\n\nFetching results/checking task status using the token can be done using `fetch()`.\n\n```python\nresults = c.fetch(token = run_response['token'])\nprint(results)\n```\n\nYou can also get the commit ID and the repo name of your hosted `eden_block` with the following snippet\n```python\ngenerator_id = c.get_generator_identity()\nprint(generator_id) ## {\"name\": repo_name, \"commit\": commit_sha}\n``` \n\n## Examples\n\n- Hosting a Resnet18 inference endpoint with eden: [server](https://github.com/abraham-ai/eden/blob/master/examples/not_so_minimal/server.py) + [client](https://github.com/abraham-ai/eden/blob/master/examples/not_so_minimal/client.py)\n- A very (very) minimal example which is good for starting out on eden: [server](https://github.com/abraham-ai/eden/blob/master/examples/minimal/server.py) + [client](https://github.com/abraham-ai/eden/blob/master/examples/minimal/client.py)\n- Working with intermediate results: [server](https://github.com/abraham-ai/eden/blob/master/examples/writing_intermediate_outputs/server.py) + [client](https://github.com/abraham-ai/eden/blob/master/examples/writing_intermediate_outputs/client.py)\n\n## Prometheus metrics out of the box\n\nEden supports the following internal metrics (`/metrics`) which have been exposed via prometheus:\n\n* `num_queued_jobs`: Specifies the number of queued jobs\n* `num_running_jobs`: Specifies the number of running jobs\n* `num_failed_jobs`: Specifies the number of failed jobs\n* `num_succeeded_jobs`: Specifies the number of succeeded jobs\n\n## Development\n\nSetup \n```\ngit clone git@github.com:abraham-ai/eden.git\ncd eden\npython3 setup.py develop\n```\nCompile dependencies with pip-compile (this generates a `requirements.txt` file). You will need `pip-tools` installed for this to work (`pip install pip-tools`)\n```\npip-compile requirements.in\n```\n\nYou also have to install redis on your machine\n```\nsudo apt-get install redis-server\nsudo service redis-server start\n```\n\nOptionally, if you want to stop redis after you're done then you can run:\n\n```\nsudo service redis-server stop\n```\n\nRunnning tests on your local machine can be done with:\n```\nsh test_local.sh\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabraham-ai%2Feden","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabraham-ai%2Feden","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabraham-ai%2Feden/lists"}