marquesafonso commited on
Commit
eb78dc9
·
1 Parent(s): 7cea0ba

initial commit

Browse files
Files changed (1) hide show
  1. README.md +88 -10
README.md CHANGED
@@ -1,12 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
- title: Audio2waveform
3
- emoji: 🏢
4
- colorFrom: yellow
5
- colorTo: pink
6
- sdk: docker
7
- pinned: false
8
- license: mit
9
- short_description: Create a waveform animation video from video or audio
10
- ---
11
 
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
1
+ ## Waveform Video Generator
2
+ This project provides a web-based interface for generating waveform videos from audio files using Gradio. The application utilizes FFmpeg and ImageMagick to overlay captions and customize the appearance of the waveform. The environment is set up using a Docker container for ease of deployment.
3
+
4
+ ### Features
5
+ - Upload an audio file to generate a waveform video.
6
+ - Customize the background color, foreground opacity, bars color, number of bars, and bar width.
7
+ - Option to add a caption text overlay on the waveform video.
8
+
9
+ ### Installation
10
+
11
+ To run this project locally, ensure you have Docker installed and follow the steps below:
12
+
13
+ ```bash
14
+ # Clone the repository
15
+ git clone <repository-url>
16
+ cd <repository-name>
17
+
18
+ # Build the Docker container
19
+ docker build -t waveform-video-generator .
20
+
21
+ # Run the Docker container
22
+ docker run -p 7860:7860 waveform-video-generator
23
+ ```
24
+
25
+ The Gradio interface should be accessible at `http://0.0.0.0:7860` in your web browser.
26
+
27
+ ### Usage
28
+
29
+ 1. Upload your audio file.
30
+ 2. Customize the waveform video by adjusting the parameters:
31
+ - Background Color
32
+ - Foreground Opacity
33
+ - Bars Color
34
+ - Number of Bars
35
+ - Bar Width
36
+ - Caption Text (optional)
37
+ 3. Click on the submit button to generate the waveform video.
38
+ 4. Download the generated waveform video.
39
+
40
+ ### Code Overview
41
+
42
+ #### app.py
43
+ The core functionality of the application is defined in the `app.py` file. The `Predictor` class contains the `predict` method, which generates the waveform video using Gradio, FFmpeg, and ImageMagick. The Gradio interface is configured to accept various input parameters to customize the waveform video's appearance.
44
+
45
+ #### Dockerfile
46
+ The `Dockerfile` sets up the required environment to run the application. It installs system dependencies such as FFmpeg and ImageMagick, as well as the necessary Python packages. The Docker container ensures that all necessary dependencies are available and configured correctly.
47
+
48
+ ```dockerfile
49
+ FROM python:3.9-slim
50
+
51
+ # Install system packages
52
+ RUN apt-get update && apt-get install -y \
53
+ ffmpeg \
54
+ imagemagick \
55
+ fontconfig \
56
+ && apt-get clean \
57
+ && rm -rf /var/lib/apt/lists/*
58
+
59
+ # Install pip packages
60
+ RUN pip install gradio==3.50.2
61
+
62
+ # Set environment variables for matplotlib and fontconfig
63
+ ENV MPLCONFIGDIR=/tmp/matplotlib
64
+ ENV FONTCONFIG_PATH=/etc/fonts
65
+
66
+ # Create needed directories with correct permissions
67
+ RUN mkdir -p /tmp/matplotlib /usr/share/fonts /src/fonts /root/.config /src/flagged && \
68
+ chmod -R 777 /tmp /usr/share/fonts /root/.config /src/fonts /src/flagged
69
+
70
+ # Copy the rest of the application code
71
+ COPY . /src
72
+
73
+ # Set the working directory
74
+ WORKDIR /src
75
+
76
+ # Set the entry point to run the prediction script
77
+ ENTRYPOINT ["python", "app.py"]
78
+ ```
79
+
80
+ ### Contributing
81
+ Feel free to submit issues or pull requests if you find any bugs or have suggestions for improvements.
82
+
83
+ ### License
84
+ This project is licensed under the MIT License.
85
+
86
  ---
 
 
 
 
 
 
 
 
 
87
 
88
+ By following the steps mentioned in the installation section, you should be able to run the Waveform Video Generator locally and leverage its features for creating customized waveform videos.
89
+
90
+ For any further queries or support, please raise an issue on the GitHub repository. Happy coding!