Update app.py
Browse files
app.py
CHANGED
|
@@ -41,7 +41,7 @@ class YukieGradio:
|
|
| 41 |
self.inAudio = gr.Audio(label="上传音频")
|
| 42 |
self.needLogmmse = gr.Checkbox(label="是否使用自带降噪")
|
| 43 |
self.slice_db = gr.Slider(label="切片阈值(较嘈杂时-30,保留呼吸声时-50,一般默认-40)",
|
| 44 |
-
maximum=0, minimum=-60, step=
|
| 45 |
self.vcTransform = gr.Number(
|
| 46 |
label="升降调(整数,可以正负,半音数量,升高八度就是12)", value=0)
|
| 47 |
self.vcSubmit = gr.Button("转换", variant="primary")
|
|
@@ -95,13 +95,13 @@ def downloadTubeUpload(query):
|
|
| 95 |
# Step 3: Get the formats for the video and find the URL for the best audio-only format
|
| 96 |
formats_url = f"https://draw-8fj.begin.app/api/info/{video_id}"
|
| 97 |
formats_response = requests.get(formats_url).json()
|
| 98 |
-
print(formats_response
|
| 99 |
best_audio_format = None
|
| 100 |
for fmt in formats_response.get("formats", []):
|
| 101 |
if fmt.get("hasVideo") is False and fmt.get("hasAudio") is True and fmt.get("container") == "mp4":
|
| 102 |
if not best_audio_format or fmt.get("audioBitrate") > best_audio_format.get("audioBitrate"):
|
| 103 |
best_audio_format = fmt
|
| 104 |
-
|
| 105 |
# If no suitable audio format was found, return None
|
| 106 |
if not best_audio_format:
|
| 107 |
return None
|
|
|
|
| 41 |
self.inAudio = gr.Audio(label="上传音频")
|
| 42 |
self.needLogmmse = gr.Checkbox(label="是否使用自带降噪")
|
| 43 |
self.slice_db = gr.Slider(label="切片阈值(较嘈杂时-30,保留呼吸声时-50,一般默认-40)",
|
| 44 |
+
maximum=0, minimum=-60, step=1, value=-40)
|
| 45 |
self.vcTransform = gr.Number(
|
| 46 |
label="升降调(整数,可以正负,半音数量,升高八度就是12)", value=0)
|
| 47 |
self.vcSubmit = gr.Button("转换", variant="primary")
|
|
|
|
| 95 |
# Step 3: Get the formats for the video and find the URL for the best audio-only format
|
| 96 |
formats_url = f"https://draw-8fj.begin.app/api/info/{video_id}"
|
| 97 |
formats_response = requests.get(formats_url).json()
|
| 98 |
+
print(formats_response["formats"])
|
| 99 |
best_audio_format = None
|
| 100 |
for fmt in formats_response.get("formats", []):
|
| 101 |
if fmt.get("hasVideo") is False and fmt.get("hasAudio") is True and fmt.get("container") == "mp4":
|
| 102 |
if not best_audio_format or fmt.get("audioBitrate") > best_audio_format.get("audioBitrate"):
|
| 103 |
best_audio_format = fmt
|
| 104 |
+
print(best_audio_format)
|
| 105 |
# If no suitable audio format was found, return None
|
| 106 |
if not best_audio_format:
|
| 107 |
return None
|