This is a set of APIs that essentially wrap Huggingface's transformers and diffusers libraries to mimic some APIs from some companies.
It is not to say that monetization, proprietary models or private datasets are bad, but rather to show that it is possible to do the same thing with open source tools with transparency and more control over your decisions you can make, if you care about that.
Don't use it. This is just a proof of concept.
But if you want to contribute to it to make it better, here are some tasks it can do, for now:
from closedapi.tasks import classify
classify("EleutherAI/gpt-neo-1.3B", [
"how are you",
], [
("hello", "A"),
("goodbye", "B"),
("what's up", "A"),
("see you later", "B"),
])
# ["A"]
from closedapi.tasks import completion
completion("gpt2", "Hello world")
# [{'generated_text': ' that\'s what you want from your life, not my life."\n\nAs'}]
from closedapi.tasks import embed
results = detect_language("papluca/xlm-roberta-base-language-detection", ["Hello world!", "Bonjour le monde!"])
results[0]["label"]
# 'en'
results[1]["label"]
# 'fr'
from closedapi.tasks import detect_language
detect_language("Hello world!")
# 'en'
from closedapi.tasks import image_generate
for image in image_generate("a dog", n=3):
image.show()
from closedapi.tasks import image_edit
for image in image_edit("dog.jpeg", "a dog wearing a hat", n=1):
image.show()
- Fake but required API keys
- Separate model services from the APIs, maybe something like transformer-deploy
- Full compatibility with the original APIs (edit, generation, etc.)
- Default models for each task
- Documentations
- Pypi package