Spaces:
Running on Zero
Running on Zero
Bring the Space up to the pyharp example standard (taxonomy tags, __main__ guard, show_error, v0.4.0)
Browse files- README.md +1 -1
- app.py +27 -27
- requirements.txt +1 -2
README.md
CHANGED
|
@@ -4,7 +4,7 @@ emoji: 💎
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
-
sdk_version:
|
| 8 |
python_version: "3.10"
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
|
|
|
| 4 |
colorFrom: green
|
| 5 |
colorTo: blue
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: 6.24.0
|
| 8 |
python_version: "3.10"
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
app.py
CHANGED
|
@@ -7,7 +7,7 @@ import torchaudio
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
|
| 9 |
# For PyHARP wrapper
|
| 10 |
-
from pyharp import ModelCard, build_endpoint
|
| 11 |
import gradio as gr
|
| 12 |
|
| 13 |
# Create a ModelCard
|
|
@@ -15,7 +15,7 @@ model_card = ModelCard(
|
|
| 15 |
name="Apollo",
|
| 16 |
description="High-quality audio restoration for lossy MP3 compressed audio. Converts low-bitrate MP3s to near-lossless quality using band-sequence modeling.",
|
| 17 |
author="JusperLee",
|
| 18 |
-
tags=[
|
| 19 |
)
|
| 20 |
|
| 21 |
def load_audio(file_path):
|
|
@@ -91,29 +91,29 @@ def process_fn(
|
|
| 91 |
return output_audio_path
|
| 92 |
|
| 93 |
# Build Gradio endpoint
|
| 94 |
-
with gr.Blocks() as demo:
|
| 95 |
-
# Define input Gradio Components
|
| 96 |
-
input_components = [
|
| 97 |
-
gr.Audio(type="filepath",
|
| 98 |
-
label="Input Audio A")
|
| 99 |
-
.harp_required(True),
|
| 100 |
-
]
|
| 101 |
-
|
| 102 |
-
# Define output Gradio Components
|
| 103 |
-
output_components = [
|
| 104 |
-
gr.Audio(type="filepath",
|
| 105 |
-
label="Output Audio")
|
| 106 |
-
.set_info("The restored audio."),
|
| 107 |
-
]
|
| 108 |
-
|
| 109 |
-
# Build a HARP-compatible endpoint
|
| 110 |
-
app = build_endpoint(
|
| 111 |
-
model_card=model_card,
|
| 112 |
-
input_components=input_components,
|
| 113 |
-
output_components=output_components,
|
| 114 |
-
process_fn=process_fn,
|
| 115 |
-
)
|
| 116 |
-
|
| 117 |
-
# run the model
|
| 118 |
if __name__ == "__main__":
|
| 119 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
from huggingface_hub import hf_hub_download
|
| 8 |
|
| 9 |
# For PyHARP wrapper
|
| 10 |
+
from pyharp import ModelCard, build_endpoint, Subcategory
|
| 11 |
import gradio as gr
|
| 12 |
|
| 13 |
# Create a ModelCard
|
|
|
|
| 15 |
name="Apollo",
|
| 16 |
description="High-quality audio restoration for lossy MP3 compressed audio. Converts low-bitrate MP3s to near-lossless quality using band-sequence modeling.",
|
| 17 |
author="JusperLee",
|
| 18 |
+
tags=[Subcategory.RESTORATION, 'audio restoration', 'music', 'apollo', 'mp3', 'lossless'],
|
| 19 |
)
|
| 20 |
|
| 21 |
def load_audio(file_path):
|
|
|
|
| 91 |
return output_audio_path
|
| 92 |
|
| 93 |
# Build Gradio endpoint
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 94 |
if __name__ == "__main__":
|
| 95 |
+
with gr.Blocks() as demo:
|
| 96 |
+
# Define input Gradio Components
|
| 97 |
+
input_components = [
|
| 98 |
+
gr.Audio(type="filepath",
|
| 99 |
+
label="Input Audio A")
|
| 100 |
+
.harp_required(True),
|
| 101 |
+
]
|
| 102 |
+
|
| 103 |
+
# Define output Gradio Components
|
| 104 |
+
output_components = [
|
| 105 |
+
gr.Audio(type="filepath",
|
| 106 |
+
label="Output Audio")
|
| 107 |
+
.set_info("The restored audio."),
|
| 108 |
+
]
|
| 109 |
+
|
| 110 |
+
# Build a HARP-compatible endpoint
|
| 111 |
+
app = build_endpoint(
|
| 112 |
+
model_card=model_card,
|
| 113 |
+
input_components=input_components,
|
| 114 |
+
output_components=output_components,
|
| 115 |
+
process_fn=process_fn,
|
| 116 |
+
)
|
| 117 |
+
|
| 118 |
+
# run the model
|
| 119 |
+
demo.queue().launch(share=True, show_error=True, pwa=True)
|
requirements.txt
CHANGED
|
@@ -1,9 +1,8 @@
|
|
| 1 |
torch==2.8.0
|
| 2 |
torchaudio==2.8.0
|
| 3 |
-
gradio==5.28.0
|
| 4 |
spaces
|
| 5 |
huggingface-hub>=0.33,<1
|
| 6 |
numpy>=1.26,<3
|
| 7 |
omegaconf==2.3.0
|
| 8 |
soundfile==0.13.1
|
| 9 |
-
git+https://github.com/TEAMuP-dev/pyharp.git@
|
|
|
|
| 1 |
torch==2.8.0
|
| 2 |
torchaudio==2.8.0
|
|
|
|
| 3 |
spaces
|
| 4 |
huggingface-hub>=0.33,<1
|
| 5 |
numpy>=1.26,<3
|
| 6 |
omegaconf==2.3.0
|
| 7 |
soundfile==0.13.1
|
| 8 |
+
git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0
|