Hev832 commited on
Commit
2321e68
1 Parent(s): 903ebdd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -56
app.py CHANGED
@@ -52,63 +52,56 @@ def process_audio(MODEL_NAME, SOUND_PATH, F0_CHANGE, F0_METHOD, MIN_PITCH, MAX_P
52
  # Gradio Blocks Interface
53
  with gr.Blocks(tite="Hex RVC") as app:
54
  gr.Markdown("## Hex RVC")
55
-
56
- # Model Input
57
- with gr.Row():
58
- MODEL_NAME = gr.Textbox(label="Model Name", placeholder="Enter model name")
59
-
60
- # Audio Upload/Input
61
- with gr.Row():
62
- SOUND_PATH = gr.Textbox(label="Audio Path (Optional)", placeholder="Leave blank to upload audio")
63
- upload_audio = gr.File(label="Upload Audio", type='filepath', file_types=["audio"])
64
-
65
- # Main Settings
66
- with gr.Row():
67
- F0_CHANGE = gr.Number(label="Pitch Change (semitones)", value=0)
68
- F0_METHOD = gr.Dropdown(choices=["crepe", "harvest", "mangio-crepe", "rmvpe", "rmvpe+", "fcpe", "fcpe_legacy",
69
- "hybrid[mangio-crepe+rmvpe]", "hybrid[mangio-crepe+fcpe]",
70
- "hybrid[rmvpe+fcpe]", "hybrid[mangio-crepe+rmvpe+fcpe]"],
71
- label="F0 Method", value="fcpe")
72
-
73
- # Other Settings
74
- with gr.Row():
75
- MIN_PITCH = gr.Textbox(label="Min Pitch", value="50")
76
- MAX_PITCH = gr.Textbox(label="Max Pitch", value="1100")
77
- CREPE_HOP_LENGTH = gr.Number(label="Crepe Hop Length", value=120)
78
- INDEX_RATE = gr.Slider(label="Index Rate", minimum=0, maximum=1, value=0.75)
79
- FILTER_RADIUS = gr.Number(label="Filter Radius", value=3)
80
- RMS_MIX_RATE = gr.Slider(label="RMS Mix Rate", minimum=0, maximum=1, value=0.25)
81
- PROTECT = gr.Slider(label="Protect", minimum=0, maximum=1, value=0.33)
82
-
83
- # Advanced Settings
84
- with gr.Accordion("Advanced Settings", open=False):
85
- SPLIT_INFER = gr.Checkbox(label="Enable Split Inference", value=False)
86
- MIN_SILENCE = gr.Number(label="Min Silence (ms)", value=500)
87
- SILENCE_THRESHOLD = gr.Number(label="Silence Threshold (dBFS)", value=-50)
88
- SEEK_STEP = gr.Slider(label="Seek Step (ms)", minimum=1, maximum=10, value=1)
89
- KEEP_SILENCE = gr.Number(label="Keep Silence (ms)", value=200)
90
- FORMANT_SHIFT = gr.Checkbox(label="Enable Formant Shift", value=False)
91
- QUEFRENCY = gr.Number(label="Quefrency", value=0)
92
- TIMBRE = gr.Number(label="Timbre", value=1)
93
- F0_AUTOTUNE = gr.Checkbox(label="Enable F0 Autotune", value=False)
94
 
95
- # Output Settings
96
- OUTPUT_FORMAT = gr.Dropdown(choices=["wav", "flac", "mp3"], label="Output Format", value="wav")
97
-
98
- # Run Button
99
- run_button = gr.Button("Run Inference")
100
-
101
- # Audio Output
102
- output_audio = gr.Audio(label="Generated Audio", type='filepath')
103
-
104
- # Run the process_audio function on button click
105
- run_button.click(
106
- process_audio,
107
- inputs=[MODEL_NAME, SOUND_PATH, F0_CHANGE, F0_METHOD, MIN_PITCH, MAX_PITCH, CREPE_HOP_LENGTH, INDEX_RATE,
108
- FILTER_RADIUS, RMS_MIX_RATE, PROTECT, SPLIT_INFER, MIN_SILENCE, SILENCE_THRESHOLD, SEEK_STEP,
109
- KEEP_SILENCE, FORMANT_SHIFT, QUEFRENCY, TIMBRE, F0_AUTOTUNE, OUTPUT_FORMAT, upload_audio],
110
- outputs=output_audio
111
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  # Launch the Gradio app
114
  app.launch()
 
52
  # Gradio Blocks Interface
53
  with gr.Blocks(tite="Hex RVC") as app:
54
  gr.Markdown("## Hex RVC")
55
+ with gr.Tab("Infernce"):
56
+ # Model Input
57
+ with gr.Row():
58
+ MODEL_NAME = gr.Textbox(label="Model Name", placeholder="Enter model name")
59
+ # Audio Upload/Input
60
+ with gr.Row():
61
+ SOUND_PATH = gr.Textbox(label="Audio Path (Optional)", placeholder="Leave blank to upload audio")
62
+ upload_audio = gr.File(label="Upload Audio", type='filepath', file_types=["audio"])
63
+ # Main Settings
64
+ with gr.Row():
65
+ F0_CHANGE = gr.Number(label="Pitch Change (semitones)", value=0)
66
+ F0_METHOD = gr.Dropdown(choices=["crepe", "harvest", "mangio-crepe", "rmvpe", "rmvpe+", "fcpe", "fcpe_legacy",
67
+ "hybrid[mangio-crepe+rmvpe]", "hybrid[mangio-crepe+fcpe]",
68
+ "hybrid[rmvpe+fcpe]", "hybrid[mangio-crepe+rmvpe+fcpe]"],
69
+ label="F0 Method", value="fcpe")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
70
 
71
+ # Other Settings
72
+ with gr.Row():
73
+ MIN_PITCH = gr.Textbox(label="Min Pitch", value="50")
74
+ MAX_PITCH = gr.Textbox(label="Max Pitch", value="1100")
75
+ CREPE_HOP_LENGTH = gr.Number(label="Crepe Hop Length", value=120)
76
+ INDEX_RATE = gr.Slider(label="Index Rate", minimum=0, maximum=1, value=0.75)
77
+ FILTER_RADIUS = gr.Number(label="Filter Radius", value=3)
78
+ RMS_MIX_RATE = gr.Slider(label="RMS Mix Rate", minimum=0, maximum=1, value=0.25)
79
+ PROTECT = gr.Slider(label="Protect", minimum=0, maximum=1, value=0.33)
80
+ # Advanced Settings
81
+ with gr.Accordion("Advanced Settings", open=False):
82
+ SPLIT_INFER = gr.Checkbox(label="Enable Split Inference", value=False)
83
+ MIN_SILENCE = gr.Number(label="Min Silence (ms)", value=500)
84
+ SILENCE_THRESHOLD = gr.Number(label="Silence Threshold (dBFS)", value=-50)
85
+ SEEK_STEP = gr.Slider(label="Seek Step (ms)", minimum=1, maximum=10, value=1)
86
+ KEEP_SILENCE = gr.Number(label="Keep Silence (ms)", value=200)
87
+ FORMANT_SHIFT = gr.Checkbox(label="Enable Formant Shift", value=False)
88
+ QUEFRENCY = gr.Number(label="Quefrency", value=0)
89
+ TIMBRE = gr.Number(label="Timbre", value=1)
90
+ F0_AUTOTUNE = gr.Checkbox(label="Enable F0 Autotune", value=False)
91
+ # Output Settings
92
+ OUTPUT_FORMAT = gr.Dropdown(choices=["wav", "flac", "mp3"], label="Output Format", value="wav")
93
+ run_button = gr.Button("Run Inference")
94
+ # Audio Output
95
+ output_audio = gr.Audio(label="Generated Audio", type='filepath')
96
+
97
+ # Run the process_audio function on button click
98
+ run_button.click(
99
+ process_audio,
100
+ inputs=[MODEL_NAME, SOUND_PATH, F0_CHANGE, F0_METHOD, MIN_PITCH, MAX_PITCH, CREPE_HOP_LENGTH, INDEX_RATE,
101
+ FILTER_RADIUS, RMS_MIX_RATE, PROTECT, SPLIT_INFER, MIN_SILENCE, SILENCE_THRESHOLD, SEEK_STEP,
102
+ KEEP_SILENCE, FORMANT_SHIFT, QUEFRENCY, TIMBRE, F0_AUTOTUNE, OUTPUT_FORMAT, upload_audio],
103
+ outputs=output_audio
104
+ )
105
 
106
  # Launch the Gradio app
107
  app.launch()