Skip to content

PyHARP Essentials

PyHARP provides a lightweight wrapper for Gradio applications to ensure compatibility with HARP. A PyHARP application is structured as follows:

application_name/
└── app.py
└── requirements.txt
└── README.md

The app.py file defines the application through a model card describing the underlying model, a list of Gradio interactive components specifying the interface, and a processing function for handling file input and output. We'll discuss these more in the following sections.

The requirements.txt file defines dependencies for the application, which are installed automatically if the application is hosted as a HuggingFace Space.

The README.md file provides additional information for hosting the application as a HuggingFace Space in its header. This file is not necessary if you only want to run your application locally. For more details, see the HuggingFace Space configuration documentation.

Running a PyHARP Application

PyHARP ships with a number of example HARP-compatible Gradio applications in the examples/ directory. Once you have installed PyHARP, you can try running one of the example applications locally:

  1. Navigate your terminal to pyharp/examples/pitch_shifter/
  2. Install dependencies: pip install -r requirements.txt
  3. Run: python app.py

Your terminal should display something like this:

* Running on local URL:  http://127.0.0.1:7860
* Running on public URL: https://8661b0cf18d5cf17ec.gradio.live

This share link expires in 1 week. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces (https://huggingface.co/spaces)

Copy the public URL -- in this example, https://8661b0cf18d5cf17ec.gradio.live -- and open up HARP. As shown below, we can link HARP to our application by selecting custom path... from the model drop-down menu and pasting our URL.

Released under the BSD 3-Clause License.