Spaces:
Runtime error
Runtime error
ai: Simply API instructions.
Browse files
API.md
CHANGED
|
@@ -1,66 +1,22 @@
|
|
| 1 |
-
####
|
| 2 |
-
|
| 3 |
```bash
|
| 4 |
-
|
| 5 |
-
#
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
|
| 9 |
-
apt update
|
| 10 |
-
apt install python3 python3-pip -q -y
|
| 11 |
-
|
| 12 |
-
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
| 13 |
-
if ! command -v brew &>/dev/null; then
|
| 14 |
-
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
| 15 |
-
fi
|
| 16 |
-
brew install python
|
| 17 |
-
|
| 18 |
-
elif [[ "$OSTYPE" == "cygwin" ]]; then
|
| 19 |
-
echo "Using Cygwin, please install Python manually."
|
| 20 |
-
|
| 21 |
-
elif [[ "$OSTYPE" == "msys" ]]; then
|
| 22 |
-
echo "Windows detected. Please install Python from python.org or using the Windows Store."
|
| 23 |
-
exit 1
|
| 24 |
-
|
| 25 |
-
fi
|
| 26 |
-
else
|
| 27 |
-
echo "Python 3 already installed!"
|
| 28 |
-
fi
|
| 29 |
-
}
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
if [[ "$OSTYPE" == "linux-gnu"* || "$OSTYPE" == "darwin"* ]]; then
|
| 34 |
-
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
|
| 35 |
-
python3 get-pip.py
|
| 36 |
-
rm get-pip.py
|
| 37 |
-
elif [[ "$OSTYPE" == "msys"* ]]; then
|
| 38 |
-
echo "Please make sure pip is installed on Windows. Install pip manually if needed."
|
| 39 |
-
fi
|
| 40 |
-
else
|
| 41 |
-
echo "pip already installed!"
|
| 42 |
-
fi
|
| 43 |
-
}
|
| 44 |
-
|
| 45 |
-
install_libraries() {
|
| 46 |
-
pip3 install gradio_client rich --upgrade
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
install_python
|
| 50 |
-
install_pip
|
| 51 |
-
install_libraries
|
| 52 |
-
|
| 53 |
-
echo "Installation complete! Python, pip, and required packages are installed."
|
| 54 |
```
|
| 55 |
|
| 56 |
-
####
|
| 57 |
-
|
| 58 |
```bash
|
| 59 |
-
nano
|
| 60 |
-
|
| 61 |
-
|
| 62 |
```
|
| 63 |
|
|
|
|
| 64 |
```python
|
| 65 |
#!/usr/bin/env python3
|
| 66 |
import sys
|
|
@@ -75,25 +31,23 @@ responses = result[0][0][1]
|
|
| 75 |
markdown = Markdown(responses)
|
| 76 |
console.print(markdown)
|
| 77 |
```
|
| 78 |
-
|
| 79 |
```bash
|
| 80 |
-
|
| 81 |
# Windows users set permissions to 755 according with linux.
|
|
|
|
| 82 |
```
|
| 83 |
|
| 84 |
-
###
|
| 85 |
-
|
| 86 |
```bash
|
| 87 |
./jarvis "Your message here."
|
|
|
|
| 88 |
```
|
| 89 |
|
| 90 |
-
####
|
| 91 |
-
|
| 92 |
```bash
|
| 93 |
# Bonus for more flexible.
|
| 94 |
sudo mv jarvis /bin/ai
|
| 95 |
-
```
|
| 96 |
|
| 97 |
-
|
| 98 |
ai "Your message here."
|
| 99 |
```
|
|
|
|
| 1 |
+
#### INSTALLATIONS
|
|
|
|
| 2 |
```bash
|
| 3 |
+
# Linux/Android (Termux)/MacOS/Windows.
|
| 4 |
+
# Make sure you have "python3" and "pip" installed.
|
| 5 |
+
# This package have very small size.
|
| 6 |
+
pip install gradio_client rich --upgrade
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
# If you are using Python 3.12 or newer.
|
| 9 |
+
pip install gradio_client rich --upgrade --ignore-installed --break-system-packages
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
```
|
| 11 |
|
| 12 |
+
#### CREATE JARVIS FILE
|
|
|
|
| 13 |
```bash
|
| 14 |
+
# I'm using nano editor.
|
| 15 |
+
# You can use any file editor you want.
|
| 16 |
+
nano jarvis # or whatever you want.
|
| 17 |
```
|
| 18 |
|
| 19 |
+
### JARVIS SCRIPT
|
| 20 |
```python
|
| 21 |
#!/usr/bin/env python3
|
| 22 |
import sys
|
|
|
|
| 31 |
markdown = Markdown(responses)
|
| 32 |
console.print(markdown)
|
| 33 |
```
|
|
|
|
| 34 |
```bash
|
| 35 |
+
# Set permission (Linux/Android [Termux]/MacOS).
|
| 36 |
# Windows users set permissions to 755 according with linux.
|
| 37 |
+
chmod a+x jarvis
|
| 38 |
```
|
| 39 |
|
| 40 |
+
### RUN JARVIS
|
|
|
|
| 41 |
```bash
|
| 42 |
./jarvis "Your message here."
|
| 43 |
+
# According the name file you create.
|
| 44 |
```
|
| 45 |
|
| 46 |
+
#### LINUX USER's
|
|
|
|
| 47 |
```bash
|
| 48 |
# Bonus for more flexible.
|
| 49 |
sudo mv jarvis /bin/ai
|
|
|
|
| 50 |
|
| 51 |
+
# Now you can run with simple command.
|
| 52 |
ai "Your message here."
|
| 53 |
```
|