Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
def main(url, parameters, progress=gr.Progress()):
|
2 |
try:
|
3 |
font_type, font_size, font_color, service, target, style, subject = parameters.split(',')
|
@@ -52,3 +61,21 @@ def main(url, parameters, progress=gr.Progress()):
|
|
52 |
|
53 |
except Exception as e:
|
54 |
raise gr.Error(f"خطا در پردازش: {str(e)}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from moviepy import VideoFileClip
|
2 |
+
import gradio as gr
|
3 |
+
import requests
|
4 |
+
import os
|
5 |
+
import time
|
6 |
+
from gradio_client import Client, handle_file
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
def main(url, parameters, progress=gr.Progress()):
|
11 |
try:
|
12 |
font_type, font_size, font_color, service, target, style, subject = parameters.split(',')
|
|
|
61 |
|
62 |
except Exception as e:
|
63 |
raise gr.Error(f"خطا در پردازش: {str(e)}")
|
64 |
+
|
65 |
+
with gr.Blocks() as demo:
|
66 |
+
gr.Markdown("Start typing below and then click **Run** to see the progress and final output.")
|
67 |
+
with gr.Column():
|
68 |
+
progress_output = gr.Textbox(label="Progress", visible=False)
|
69 |
+
video_file_input = gr.Text(label="Video URL")
|
70 |
+
clip_type = gr.Dropdown(["dub", "sub"], label="Clip Type")
|
71 |
+
parameters = gr.Text(label="Additional Parameters (for subtitles: color,font)")
|
72 |
+
btn = gr.Button("Create")
|
73 |
+
video_file_output = gr.Video(label="Result Video")
|
74 |
+
btn.click(
|
75 |
+
fn=main,
|
76 |
+
inputs=[video_file_input, clip_type, parameters],
|
77 |
+
outputs=[progress_output, video_file_output],
|
78 |
+
concurrency_limit=4,
|
79 |
+
)
|
80 |
+
|
81 |
+
demo.launch(debug=True)
|