ai / API.md
hadadrjt's picture
ai: Simply API instructions.
934df70
|
raw
history blame
1.27 kB

INSTALLATIONS

# Linux/Android (Termux)/MacOS/Windows.
# Make sure you have "python3" and "pip" installed.
# This package have very small size.
pip install gradio_client rich --upgrade

# If you are using Python 3.12 or newer.
pip install gradio_client rich --upgrade --ignore-installed --break-system-packages

CREATE JARVIS FILE

# I'm using nano editor.
# You can use any file editor you want.
nano jarvis # or whatever you want.

JARVIS SCRIPT

#!/usr/bin/env python3
import sys
from gradio_client import Client
from rich.console import Console
from rich.markdown import Markdown
console = Console()
jarvis = Client("hadadrjt/ai")
input = " ".join(sys.argv[1:]) if len(sys.argv) > 1 else "Hi!"
result = jarvis.predict(multi={"text": input}, api_name="/api")
responses = result[0][0][1]
markdown = Markdown(responses)
console.print(markdown)
# Set permission (Linux/Android [Termux]/MacOS).
# Windows users set permissions to 755 according with linux.
chmod a+x jarvis

RUN JARVIS

./jarvis "Your message here."
# According the name file you create.

LINUX USER's

# Bonus for more flexible.
sudo mv jarvis /bin/ai

# Now you can run with simple command.
ai "Your message here."