Skip to content

Commit

Permalink
Merge pull request #46 from dfgHiatus/feat/linux-installer
Browse files Browse the repository at this point in the history
(feat/fix) Add Linux installer script, fix misc_utils.py, update README
  • Loading branch information
scuffedplus authored Oct 18, 2024
2 parents 1e84dd0 + 3447e95 commit 9050a12
Show file tree
Hide file tree
Showing 3 changed files with 139 additions and 38 deletions.
20 changes: 8 additions & 12 deletions BabbleApp/utils/misc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@
import platform
import cv2
import subprocess
from pygrabber.dshow_graph import FilterGraph

is_nt = True if sys.platform.startswith('win') else False
graph = FilterGraph()

# Detect the operating system
is_nt = os.name == "nt"
os_type = platform.system()

if is_nt:
from pygrabber.dshow_graph import FilterGraph
graph = FilterGraph()


def list_camera_names():
cam_list = graph.get_input_devices()
cam_names = []
Expand All @@ -20,14 +24,6 @@ def list_camera_names():
cam_names = cam_names + list_serial_ports()
return cam_names

# Detect the operating system
is_nt = True if os.name == "nt" else False
os_type = platform.system()

if is_nt:
from pygrabber.dshow_graph import FilterGraph
graph = FilterGraph()


def list_cameras_opencv():
""" Use OpenCV to check available cameras by index (fallback for Linux/macOS) """
Expand Down
79 changes: 53 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,65 @@

![Babble Logo](https://github.com/SummerSigh/ProjectBabble/blob/SummerSigh-patch-4/Babble.png?raw=true)

# Table of Contents
- [What is Babble?](#what-is-babble)
<h3 align="center">
Project Babble is an open-source mouth tracking project designed to work with any VR headset. We strive to make our models robust to different lighting, cameras, image qualities and facial structures!
</h3>

## Table of Contents
- [Features](#features)
- [How do I set it up?](#setup-more-detailed-wiki-and-setup-video-coming-soon)
- [Useful Links](#useful-links)
- [Installation](#installation)
- [Usage](#usage)
- [Links](#links)


## What is Babble?

<p align="center">
Babble is an opensource mouth tracking project designed to work with any existing VR headset. We strive to make our models robust to different lighting, cameras, image qualities, and facial structures!
</p>

## Features
- 100% Opensource! 🌟
- 100% open-source! 🌟
- Fast and robust! 🚀
- Works with most existing blendshape standards! ⚙️
- Works with existing blendshape standards! ⚙️
- Constantly updated and modified! 🔧

## Setup (More detailed wiki and setup video coming soon!)
To install babble is fairly simple! Head over to the releases tab and download the EXE located there. Run the EXE and install babble! After that, you can test with a USB WEBCAM by doing the following steps:
## Installation
### Windows
Head to the releases section and [download the latest installer](https://github.com/Project-Babble/ProjectBabble/releases/latest).

### Linux
Install `git`, `curl` and a version of `python` greater than `3.8` for your distro.

Then, copy paste and run the following script into the terminal of your choice:

```bash
bash -c "$(curl -fsSL https://gist.githubusercontent.com/dfgHiatus/a92a3caae24c1bfab1c7544537a654c5/raw/fc30aa550c3c7aa83c37a72168e75ef92388e39b/project-babble-install.sh)"
```

Once it's finished installing, you can update and run the Babble app by typing `babble-app` into your terminal.

*You should also be able to run the Windows executable through Wine!*

#### Notes:
If you receive a `["Error listing UVC devices on Linux ... No such file or directory"]` when choosing/changing your camera, you'll need to install video4linux (`v4l-utils`) for your distro.

For Ubuntu or other distros with apt:
```bash
sudo apt-get install v4l-utils
```

If you receive a `ModuleNotFoundError: No module named 'tkinter'` error message on run, you'll need to install `tkinter` for your distro.

For Ubuntu or other distros with apt:
```bash
sudo apt-get install python3-tk
```
For Fedora:
```bash
sudo dnf install python3-tkinter
```

- Run the babble app
- Enter 0 into the camera address bar
- Enter cropping mode where your camera feed should be
- Crop your mouth out of the frame
- Open VRCFT
- Install the babble module
- Test in VRC with a VRCFT-compatible avatar
You can read more about this [here](https://stackoverflow.com/questions/25905540/importerror-no-module-named-tkinter).

## Usage
We have integrations for [VRChat](https://docs.babble.diy/docs/software/integrations/vrc), [Resonite](https://docs.babble.diy/docs/software/integrations/resonite) and [ChilloutVR](https://docs.babble.diy/docs/software/integrations/chilloutVR)!

## Useful links
- [Our Discord!](https://discord.gg/XAMZmjBktk)
- [Wandb Runs](https://wandb.ai/summerai/ProjectBabble)
Looking for something else? Check out our [documentation](https://docs.babble.diy/)!

## Links
- [Our Discord](https://discord.gg/XAMZmjBktk)
- [Our Twitter](https://x.com/projectBabbleVR)
- [Wandb Runs](https://wandb.ai/summerai/ProjectBabble)
78 changes: 78 additions & 0 deletions babbleapp.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/bin/bash

# Check if running on Linux
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
echo "Error: This script is only compatible with Linux operating systems."
exit 1
fi

# Check Python version
if ! command -v python3 &> /dev/null; then
echo "Error: Python is not installed. Please install Python 3.8 or higher."
exit
fi

python_version_major=$(python3 -c 'import platform; print(platform.python_version_tuple()[0])')
python_version_minor=$(python3 -c 'import platform; print(platform.python_version_tuple()[1])')
if (( python_version_major < 3 || python_version_minor < 8 )); then
echo "Error: Your Python version is too low! Please install 3.8 or higher."
exit 1
fi

# Set installation directory
install_dir="$HOME/.local/share/project-babble"

# Function to install requirements
install_requirements() {
cd $install_dir
cd BabbleApp
echo "Installing requirements..."
# Create a temporary requirements file without the Windows-only package
grep -v "onnxruntime-directml" requirements.txt > linux_requirements.txt
pip install -r linux_requirements.txt --quiet
rm linux_requirements.txt
}

# Function to get the latest release tag
get_latest_tag() {
git fetch --tags
git describe --tags --abbrev=0
}

# Function to update the repository
update_repo() {
echo "Checking for updates..."
git fetch --tags
local_tag=$(git describe --tags --abbrev=0)
remote_tag=$(git describe --tags --abbrev=0 origin/main)

if [ "$local_tag" != "$remote_tag" ]; then
echo "New version available: $remote_tag"
echo "Current version: $local_tag"
echo "Updating to the latest version..."
git checkout "$remote_tag"
echo "Updating dependencies..."
source venv/bin/activate
install_requirements
deactivate
echo "Project Babble has been updated successfully to version $remote_tag!"
else
echo "Project Babble is already at the latest version: $local_tag"
fi
}


cd $install_dir
cd BabbleApp

# Create venv if it does not exists
if ! [ -d "venv" ]; then
python3 -m venv venv
fi

source venv/bin/activate
update_repo
echo "Verifying dependencies. This might take a second!"
install_requirements
echo "Starting Babble app..."
python3 babbleapp.py

0 comments on commit 9050a12

Please sign in to comment.