Run Any Hugging face spaces locally : Easy steps

Amrqawasmeh
2 min readDec 26, 2023

--

Introduction:

Embarking on a PyTorch project is an exciting venture, but the complexity of setup can be a stumbling block. Fear not! This comprehensive guide not only simplifies the process but also introduces seamless integration with Hugging Face, enabling you to run any Hugging Face spaces locally. Whether you’re a seasoned developer or just starting, this step-by-step tutorial ensures you effortlessly navigate from installing Anaconda to deploying your project with Gradio.

Step 1: Install Anaconda

Begin by ensuring you have Anaconda installed on your system. If not, download and install it from the official Anaconda website: Anaconda Distribution.

to download anaconda you can visit
https://www.anaconda.com/download

Step 2: Effortless PyTorch Installation with Conda

Facilitate the installation of PyTorch, torchvision, and torchaudio with CUDA support using the following concise command:

conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia

Step 3: Clone the Repository from Hugging Face

Execute the git clone command to effortlessly clone the repository from Hugging Face:

git clone <repository_url>

Replace <repository_url> with the URL of your desired repository.

Step 4: Streamlining Requirements.txt

Prior to running the pip install -r requirements.txt command, ensure to review the requirements.txt file. If it contains entries for torch and torchvision, promptly remove them.

Step 5: Swift Pip Installation for CUDA

Simplify the PyTorch and torchvision installation process with CUDA support using the following Pip command:

pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118

Step 6: Effortless Gradio Installation

Enhance your project by integrating Gradio seamlessly. Install it effortlessly using the command:

pip install -U gradio

Step 7: Launch Your Project with Gradio

Initiate your project with Gradio by executing the following command:

gradio app.py

This straightforward command will kickstart the Gradio app, making your project accessible through a web browser.

Ensure to replace <repository_url> with the actual URL of the Hugging Face repository and <app.py> with the appropriate file name if different in your project.

--

--

Amrqawasmeh

Full stack dev & designer with a passion for creating innovative solutions. Skilled in Laravel, Ionic, & Figma. Experienced with variety of clients & industries