Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,9 +24,12 @@ def main(url, parameters, progress=gr.Progress()):
|
|
| 24 |
time.sleep(0.5)
|
| 25 |
progress(0.35, desc="تبدیل صوت به متن")
|
| 26 |
|
| 27 |
-
results = job.outputs()
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
finally:
|
| 31 |
transcribe_client.close()
|
| 32 |
|
|
@@ -65,11 +68,8 @@ def main(url, parameters, progress=gr.Progress()):
|
|
| 65 |
time.sleep(0.5)
|
| 66 |
progress(0.75, desc="پردازش ویدئو")
|
| 67 |
|
| 68 |
-
output_video = job.outputs()[0]
|
| 69 |
|
| 70 |
-
# Handle different output formats
|
| 71 |
-
if isinstance(output_video, dict):
|
| 72 |
-
output_video = output_video.get('video', output_video.get('output'))
|
| 73 |
|
| 74 |
# Create temporary file
|
| 75 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmp_file:
|
|
@@ -80,6 +80,7 @@ def main(url, parameters, progress=gr.Progress()):
|
|
| 80 |
# Generate direct download link
|
| 81 |
base_url = os.environ.get('GRADIO_SERVER_NAME', 'http://localhost:7860')
|
| 82 |
download_url = f"{base_url}/file/{tmp_file_path}"
|
|
|
|
| 83 |
|
| 84 |
finally:
|
| 85 |
video_client.close()
|
|
|
|
| 24 |
time.sleep(0.5)
|
| 25 |
progress(0.35, desc="تبدیل صوت به متن")
|
| 26 |
|
| 27 |
+
results = job.outputs()[0]
|
| 28 |
+
print(results)
|
| 29 |
+
if len(results) != 3:
|
| 30 |
+
raise ValueError(f"Expected 3 outputs, got {len(results)}")
|
| 31 |
+
|
| 32 |
+
srt_file, video, mp3_file = results
|
| 33 |
finally:
|
| 34 |
transcribe_client.close()
|
| 35 |
|
|
|
|
| 68 |
time.sleep(0.5)
|
| 69 |
progress(0.75, desc="پردازش ویدئو")
|
| 70 |
|
| 71 |
+
output_video = job.outputs()[0]['video']
|
| 72 |
|
|
|
|
|
|
|
|
|
|
| 73 |
|
| 74 |
# Create temporary file
|
| 75 |
with tempfile.NamedTemporaryFile(delete=False, suffix=".mp4") as tmp_file:
|
|
|
|
| 80 |
# Generate direct download link
|
| 81 |
base_url = os.environ.get('GRADIO_SERVER_NAME', 'http://localhost:7860')
|
| 82 |
download_url = f"{base_url}/file/{tmp_file_path}"
|
| 83 |
+
print(download_url)
|
| 84 |
|
| 85 |
finally:
|
| 86 |
video_client.close()
|