{"id":25353920,"url":"https://github.com/aborroy/communitylive-avatar","last_synced_at":"2026-01-21T00:33:55.740Z","repository":{"id":255349944,"uuid":"849303956","full_name":"aborroy/communitylive-avatar","owner":"aborroy","description":"Avatar generator for Hyland Connect presented in Hyland CommunityLIVE 2024","archived":false,"fork":false,"pushed_at":"2024-09-26T08:57:25.000Z","size":3956,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-09T01:44:06.334Z","etag":null,"topics":["gen-ai","img-to-img","stable-diffusion-webui"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aborroy.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":"2024-08-29T11:03:22.000Z","updated_at":"2024-09-26T08:57:29.000Z","dependencies_parsed_at":"2024-09-17T18:21:53.352Z","dependency_job_id":null,"html_url":"https://github.com/aborroy/communitylive-avatar","commit_stats":null,"previous_names":["aborroy/communitylive-avatar"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/aborroy/communitylive-avatar","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aborroy%2Fcommunitylive-avatar","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aborroy%2Fcommunitylive-avatar/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aborroy%2Fcommunitylive-avatar/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aborroy%2Fcommunitylive-avatar/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aborroy","download_url":"https://codeload.github.com/aborroy/communitylive-avatar/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aborroy%2Fcommunitylive-avatar/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28619800,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T23:49:58.628Z","status":"ssl_error","status_checked_at":"2026-01-20T23:47:29.996Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["gen-ai","img-to-img","stable-diffusion-webui"],"created_at":"2025-02-14T19:56:05.164Z","updated_at":"2026-01-21T00:33:55.724Z","avatar_url":"https://github.com/aborroy.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Avatar Generator for Hyland CommunityLIVE 2024\n\nThis project provides a web application that generates avatars from headshots captured via webcam or uploaded files. It leverages the `img2img` functionality of the [Stable Diffusion](https://stability.ai) REST API, which is integrated through the [Stable Diffusion WebUI](https://github.com/AUTOMATIC1111/stable-diffusion-webui).\n\n## Features\n\n- **Avatar Creation**: Generate personalized avatars from headshots.\n- **Flexible Input**: Accepts images from both webcam captures and file uploads.\n- **Customizable**: Adjust the fantasy and gender preferences for the generated avatar.\n- **Email Delivery**: Send the generated avatar directly to users via email.\n\n## Requirements\n\n- **Python**: Version 3.10\n- **Stable Diffusion WebUI**: [GitHub Repository](https://github.com/AUTOMATIC1111/stable-diffusion-webui)\n- **GPU**: Recommended for optimal performance\n- **AWS CLI**: Required for utilizing AWS SES (Simple Email Service) to send avatars via email\n\n## Samples\n\n![Guido van Rossum](samples/sample-avatar-sequence.png)\n\n## Project Structure\n\nThe project is centered around a Python application (`app.py`) that exposes a REST API. This API processes an original image along with optional parameters (fantasy level and gender preference) and returns the generated avatar. The following directories and files are included:\n\n```bash\n.\n├── app.py           # Main application file exposing REST API\n├── static           # Static resources for the web application\n│   ├── Hyland_logo.png\n│   └── style.css\n└── templates        # HTML templates\n    └── index.html\n```\n\n## Setting Up Stable Diffusion WebUI\n\nThe Python application is configured to connect to the Stable Diffusion REST API at `http://localhost:7861/sdapi/v1/img2img` by default. Follow these steps to install and set up the REST API locally:\n\n1. **Clone the Stable Diffusion WebUI Repository**\n\n   ```bash\n   git clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\n   cd stable-diffusion-webui\n   ```\n\n2. **Download a Stable Diffusion Model from Hugging Face**\n\n   ```bash\n   cd models/Stable-diffusion\n   wget https://huggingface.co/lllyasviel/fav_models/resolve/main/fav/realisticVisionV51_v51VAE.safetensors\n   cd ../..\n   ```\n\n3. **Create a Virtual Environment**\n\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate\n   ```\n\n4. **Install Dependencies and Start the WebUI**\n\n   Run the script to install requirements and start the application:\n\n   ```bash\n   ./webui.sh\n   ```\n\n   Once the application is running at `http://127.0.0.1:7860`, you can stop it with `Ctrl+C`.  \n   _Note: This step is required only during the initial setup._\n\n5. **Start the REST API**\n\n   If you don't have a GPU, you can start the API using the CPU:\n\n   ```bash\n   python3 launch.py --nowebui --skip-python-version-check --always-cpu --skip-torch-cuda-test\n   ```\n\n   The API will be accessible via your browser at `http://localhost:7861/docs#/default/img2imgapi_sdapi_v1_img2img_post`.\n\n## Local Testing\n\nTo test the application locally:\n\n1. **Start the Stable Diffusion REST API** and ensure `http://localhost:7861/sdapi/v1/img2img` is reachable.\n\n2. **Start the Web Application**\n\n   Set up the Python environment and run the application:\n\n   ```bash\n   python3 -m venv venv\n   source venv/bin/activate\n   pip install flask requests Pillow boto3\n   python3 app.py\n   ```\n\n3. **Access the Web Application**\n\n   Open a web browser and navigate to `http://localhost:5000` to use the avatar generator.\n\n## Deployment on AWS EC2\n\nTo deploy the application on an AWS EC2 instance, follow the usual process of setting up a server, ensuring that Python 3.10, the Stable Diffusion WebUI, and other dependencies are properly installed. Adjust security groups and instance types based on whether you are using a GPU. Refer to the [AWS documentation](https://docs.aws.amazon.com/ec2/index.html) for detailed instructions.\n\n\n### Sample Deployment Guide for AWS EC2 with GPU\n\nThis guide outlines the steps to deploy the Avatar Generator application on an AWS EC2 instance equipped with a GPU.\n\n#### **EC2 Instance Configuration**\n\n- **Amazon Machine Image (AMI)**: Ubuntu 22.04\n- **Instance Type**: `g4dn.xlarge`\n- **Network Settings**: Open port 443 (for HTTPS)\n- **Storage**: 60 GB\n\n#### **1. Install NVIDIA Drivers**\n\n**Update System Packages**\n\n```bash\nsudo apt-get update\nsudo apt-get upgrade -y\n```\n\n**Verify NVIDIA Device Presence**\n\n```bash\nsudo lshw -c video\n```\n\nYou should see output indicating the presence of an NVIDIA GPU, such as:\n\n```\n  *-display:1\n       description: 3D controller\n       product: TU104GL [Tesla T4]\n       vendor: NVIDIA Corporation\n```\n\n**Install NVIDIA Drivers**\n\n```bash\nsudo apt install -y ubuntu-drivers-common\nsudo ubuntu-drivers autoinstall\n```\n\n**Reboot the Instance**\n\n```bash\nsudo reboot\n```\n\nAfter rebooting, verify the NVIDIA drivers are correctly installed:\n\n```bash\nnvidia-smi\n```\n\nExpected output should show the NVIDIA driver version and CUDA version.\n\nFor additional details on installing NVIDIA drivers, refer to [Ubuntu's documentation](https://documentation.ubuntu.com/aws/en/latest/aws-how-to/instances/install-nvidia-drivers/).\n\n#### **2. Install Stable Diffusion WebUI**\n\n**Clone the Stable Diffusion WebUI Repository**\n\n```bash\ngit clone https://github.com/AUTOMATIC1111/stable-diffusion-webui\ncd stable-diffusion-webui\n```\n\n**Download Stable Diffusion Model**\n\n```bash\ncd models/Stable-diffusion\nwget https://huggingface.co/lllyasviel/fav_models/resolve/main/fav/realisticVisionV51_v51VAE.safetensors\ncd ../..\n```\n\n**Install Python Package Installer**\n\n```bash\nsudo apt install python3-pip\n```\n\n**Create and Activate a Virtual Environment**\n\n```bash\npython3 -m venv venv\nsource venv/bin/activate\n```\n\n**Install Dependencies and Start WebUI**\n\n```bash\n./webui.sh\n```\n\nYou can stop the application with `Ctrl+C` after it starts running at `http://127.0.0.1:7860`.\n\n**Start the REST API**\n\n```bash\npython3 launch.py --nowebui --skip-python-version-check --skip-torch-cuda-test\n```\n\n**Create a Startup Script for the REST API**\n\nCreate a script to easily start the API in the future:\n\n```bash\n$ cat start_api.sh\n#!/bin/bash\n\n# Navigate to the stable-diffusion-webui directory\ncd stable-diffusion-webui\n\n# Create a virtual environment if it doesn't exist\nif [ ! -d \"venv\" ]; then\n    python3 -m venv venv\nfi\n\n# Activate the virtual environment\nsource venv/bin/activate\n\n# Launch the application and write output to api.log\npython3 launch.py --nowebui --skip-python-version-check --skip-torch-cuda-test \u003e ../api.log 2\u003e\u00261 \u0026\n\n# Print a message indicating the application has started\necho \"API has started. Output is being written to api.log\"\n```\n\n#### **3. Install the Web Application**\n\n**Clone the Web Application Repository**\n\n```bash\ngit clone https://github.com/aborroy/communitylive-avatar.git\ncd communitylive-avatar\n```\n\n**Create a Virtual Environment and Start the Application**\n\n```bash\npython3 -m venv venv\nsource venv/bin/activate\npip install flask requests Pillow boto3\npython3 app.py\n```\n\n**Create a Startup Script for the Web Application**\n\nCreate a script to easily start the web application:\n\n```bash\n$ cat start_app.sh\n#!/bin/bash\n\n# Navigate to the app directory\ncd communitylive-avatar\n\n# Create a virtual environment if it doesn't exist\nif [ ! -d \"venv\" ]; then\n    python3 -m venv venv\nfi\n\n# Activate the virtual environment\nsource venv/bin/activate\n\n# Launch the application and write output to app.log\npython3 app.py \u003e ../app.log 2\u003e\u00261 \u0026\n\n# Print a message indicating the application has started\necho \"Application has started. Output is being written to app.log\"\n```\n\n#### **4. Configure HTTPS**\n\nSince the application uses a webcam, a secure HTTPS connection is required. Use AWS Route 53 to route traffic to the EC2 instance. Example DNS: `communitylive-avatar.alfdemo.com`.\n\n**Install NGINX**\n\n```bash\nsudo apt-get install nginx\n```\n\n**Install Certbot and NGINX Plugin**\n\n```bash\nsudo apt-get install certbot python3-certbot-nginx\n```\n\n**Configure NGINX**\n\nCreate an NGINX configuration file:\n\n```bash\nsudo vi /etc/nginx/sites-available/app\n```\n\nAdd the following configuration:\n\n```nginx\nserver {\n    listen 80;\n    server_name communitylive-avatar.alfdemo.com;\n\n    client_max_body_size 64M;\n\n    location / {\n        proxy_pass http://127.0.0.1:5000;\n        proxy_set_header Host $host;\n        proxy_set_header X-Real-IP $remote_addr;\n        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;\n        proxy_set_header X-Forwarded-Proto $scheme;\n    }\n}\n```\n\n**Enable the NGINX Configuration**\n\n```bash\nsudo ln -s /etc/nginx/sites-available/app /etc/nginx/sites-enabled\n```\n\n**Test NGINX Configuration and Reload**\n\n```bash\nsudo nginx -t\nsudo systemctl reload nginx\n```\n\n**Obtain an SSL Certificate**\n\n```bash\nsudo certbot --nginx -d communitylive-avatar.alfdemo.com\n```\n\nCertbot will automatically configure NGINX to use TLS on port 443.\n\n#### **5. Install AWS CLI and configure AWS SES**\n\nTo enable email delivery of avatars using AWS SES (Simple Email Service), follow these steps:\n\n1. **Install AWS CLI**:\n   - Download and install the AWS Command Line Interface (CLI) by following the instructions on the [AWS CLI Installation Guide](https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html).\n   \n2. **Configure AWS CLI**:\n   - After installation, configure your AWS CLI by running the following command:\n     ```bash\n     aws configure\n     ```\n     - Enter your **AWS Access Key ID**, **Secret Access Key**, **Region**, and **Output format** when prompted.\n\n3. **Set Up AWS SES**:\n   - Verify your email address in the AWS SES Console or via the AWS CLI:\n     ```bash\n     aws ses verify-email-identity --email-address your_email@example.com\n     ```\n   - Once verified, you can send emails programmatically through the SES service.\n\n4. **Test SES Email Sending**:\n   - You can test sending an email using the following CLI command:\n     ```bash\n     aws ses send-email --from your_email@example.com --destination ToAddresses=recipient_email@example.com --message \"Subject={Data=Test Email},Body={Text={Data=Hello!}}\" \n     ```\n\nWith AWS SES configured, your application will be able to send the generated avatars via email to the specified recipients.\n\n#### **6. Access the Application**\n\nIf all steps are completed successfully, your application will be accessible at [https://communitylive-avatar.alfdemo.com](https://communitylive-avatar.alfdemo.com).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faborroy%2Fcommunitylive-avatar","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faborroy%2Fcommunitylive-avatar","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faborroy%2Fcommunitylive-avatar/lists"}