harp-dev commited on
Commit
fcdab42
·
verified ·
1 Parent(s): 0367c57

Bring the Space up to the pyharp example standard (taxonomy tags, __main__ guard, show_error, v0.4.0)

Browse files
Files changed (3) hide show
  1. README.md +1 -1
  2. app.py +29 -29
  3. requirements.txt +2 -3
README.md CHANGED
@@ -4,7 +4,7 @@ emoji: ✏️
4
  colorFrom: indigo
5
  colorTo: purple
6
  sdk: gradio
7
- sdk_version: 5.28.0
8
  python_version: "3.10.13"
9
  app_file: app.py
10
  pinned: false
 
4
  colorFrom: indigo
5
  colorTo: purple
6
  sdk: gradio
7
+ sdk_version: 6.24.0
8
  python_version: "3.10.13"
9
  app_file: app.py
10
  pinned: false
app.py CHANGED
@@ -9,7 +9,7 @@ import gradio as gr
9
  import torch
10
  import torchaudio
11
  from huggingface_hub import hf_hub_download
12
- from pyharp import ModelCard, build_endpoint
13
 
14
  from data.tokenizer import AudioTokenizer, TextTokenizer
15
  from inference_speech_editing_scale import inference_one_sample
@@ -69,33 +69,33 @@ def edit_speech(audio_path: str, target_text: str, start_time: float, end_time:
69
  return str(output_path)
70
 
71
 
72
- with gr.Blocks(title="VoiceCraft") as demo:
73
- build_endpoint(
74
- model_card=ModelCard(
75
- name="VoiceCraft",
76
- description="Edit English speech while retaining the surrounding recording.",
77
- author="VoiceCraft",
78
- tags=["speech-editing", "voicecraft", "audio"],
79
- ),
80
- input_components=[
81
- gr.Audio(type="filepath", label="Speech Recording")
82
- .harp_required(True)
83
- .set_info("English speech to edit."),
84
- gr.Textbox(label="Target Transcript", lines=4)
85
- .harp_required(True)
86
- .set_info("Full transcript of the recording, with the replacement words in place."),
87
- gr.Number(label="Edit Start (seconds)", value=0.5, precision=2)
88
- .set_info("Start of the words to replace."),
89
- gr.Number(label="Edit End (seconds)", value=1.5, precision=2)
90
- .set_info("End of the words to replace."),
91
- ],
92
- output_components=[
93
- gr.Audio(type="filepath", label="Edited Speech")
94
- .set_info("16 kHz WAV recording."),
95
- ],
96
- process_fn=edit_speech,
97
- )
 
98
 
99
 
100
- if __name__ == "__main__":
101
- demo.queue(default_concurrency_limit=1).launch(show_error=True, pwa=True)
 
9
  import torch
10
  import torchaudio
11
  from huggingface_hub import hf_hub_download
12
+ from pyharp import ModelCard, build_endpoint, Subcategory
13
 
14
  from data.tokenizer import AudioTokenizer, TextTokenizer
15
  from inference_speech_editing_scale import inference_one_sample
 
69
  return str(output_path)
70
 
71
 
72
+ if __name__ == "__main__":
73
+ with gr.Blocks(title="VoiceCraft") as demo:
74
+ build_endpoint(
75
+ model_card=ModelCard(
76
+ name="VoiceCraft",
77
+ description="Edit English speech while retaining the surrounding recording.",
78
+ author="VoiceCraft",
79
+ tags=[Subcategory.EDITING, 'speech-editing', 'voicecraft', 'audio'],
80
+ ),
81
+ input_components=[
82
+ gr.Audio(type="filepath", label="Speech Recording")
83
+ .harp_required(True)
84
+ .set_info("English speech to edit."),
85
+ gr.Textbox(label="Target Transcript", lines=4)
86
+ .harp_required(True)
87
+ .set_info("Full transcript of the recording, with the replacement words in place."),
88
+ gr.Number(label="Edit Start (seconds)", value=0.5, precision=2)
89
+ .set_info("Start of the words to replace."),
90
+ gr.Number(label="Edit End (seconds)", value=1.5, precision=2)
91
+ .set_info("End of the words to replace."),
92
+ ],
93
+ output_components=[
94
+ gr.Audio(type="filepath", label="Edited Speech")
95
+ .set_info("16 kHz WAV recording."),
96
+ ],
97
+ process_fn=edit_speech,
98
+ )
99
 
100
 
101
+ demo.queue(default_concurrency_limit=1).launch(share=True, show_error=True, pwa=True)
 
requirements.txt CHANGED
@@ -2,9 +2,8 @@ torch==2.8.0
2
  torchaudio==2.8.0
3
  xformers==0.0.32.post2
4
  numpy==2.0.2
5
- gradio==5.28.0
6
  spaces>=0.51.1
7
- huggingface-hub>=0.33.5,<1.0
8
  phonemizer==3.2.1
9
  num2words==0.5.13
10
  av
@@ -26,4 +25,4 @@ torchmetrics
26
  encodec
27
  protobuf
28
  safetensors
29
- git+https://github.com/TEAMuP-dev/pyharp.git@v0.3.0
 
2
  torchaudio==2.8.0
3
  xformers==0.0.32.post2
4
  numpy==2.0.2
 
5
  spaces>=0.51.1
6
+ huggingface-hub
7
  phonemizer==3.2.1
8
  num2words==0.5.13
9
  av
 
25
  encodec
26
  protobuf
27
  safetensors
28
+ git+https://github.com/TEAMuP-dev/pyharp.git@v0.4.0