Spaces:
Sleeping
Sleeping
smellslikeml
commited on
Commit
•
b3167b2
1
Parent(s):
f2abffb
added auto_adjuster
Browse files- app.py +4 -0
- audio_adjustment.py +18 -0
- requirements.txt +3 -0
- tool_config.json +6 -0
app.py
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers.tools.base import launch_gradio_demo
|
2 |
+
from audio_adjustment import AudioAdjustmentTool
|
3 |
+
|
4 |
+
launch_gradio_demo(AudioAdjustmentTool)
|
audio_adjustment.py
ADDED
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import ffmpeg
|
2 |
+
from transformers import Tool
|
3 |
+
|
4 |
+
class AudioAdjustmentTool(Tool):
|
5 |
+
name = "audio_adjustment_tool"
|
6 |
+
description = """
|
7 |
+
This tool modifies audio levels for an input video.
|
8 |
+
Inputs are input_path, output_path, level (e.g. 0.5 or -13dB).
|
9 |
+
"""
|
10 |
+
inputs = ["text", "text", "text"]
|
11 |
+
outputs = ["None"]
|
12 |
+
|
13 |
+
def __call__(self, input_path: str, output_path: str, level: str):
|
14 |
+
(
|
15 |
+
ffmpeg.input(input_path)
|
16 |
+
.output(output_path, af="volume={}".format(level))
|
17 |
+
.run()
|
18 |
+
)
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
ffmpeg-python
|
2 |
+
huggingface_hub
|
3 |
+
transformers
|
tool_config.json
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"description": "This tool modifies audio levels for an input video. Inputs are input_path, output_path, level (e.g. 0.5 or -13dB).",
|
3 |
+
"name": "audio_adjustment_tool",
|
4 |
+
"tool_class": "audio_adjustment.AudioAdjustmentTool"
|
5 |
+
}
|
6 |
+
|