| | import os |
| | import gradio as gr |
| | from oss_utils import ossService, get_random_string |
| |
|
| | def refresh_video(uuid, request_id, task_id): |
| | if uuid is None or uuid == '': |
| | uuid = get_random_string() |
| | print(f'[refresh_video] generate a uuid {uuid}') |
| |
|
| | print(f'[refresh_video] uuid: {uuid}') |
| | print(f'[refresh_video] request_id: {request_id}') |
| |
|
| | notes = '正在处理您的视频生成任务,需等待4.8分钟左右,点击刷新获取最新生成进度' |
| | output = 'output/20241025174546.mp4' |
| | return uuid, request_id, task_id |
| |
|
| |
|
| | with gr.Blocks() as demo: |
| | with gr.Row(): |
| | with gr.Column(scale=0.8, min_width=0.8): |
| | |
| | user_notes = gr.Textbox(show_label=False, text_align='left') |
| | with gr.Column(scale=0.2, min_width=0.2): |
| | refresh_button = gr.Button(value="刷新", elem_id='button_param1') |
| |
|
| | uuid = gr.Text(label="huggingface_uuid", visible=True) |
| | request_id = gr.Text(label="huggingface_request_id", visible=True) |
| | task_id = gr.Text(label="huggingface_task_id", visible=True) |
| |
|
| | refresh_button.click( |
| | fn=refresh_video, |
| | queue=False, |
| | inputs=[uuid, request_id, task_id], |
| | outputs=[uuid, request_id, task_id] |
| | ) |
| |
|
| |
|
| |
|
| | if __name__ == "__main__": |
| | demo.queue(max_size=100) |
| | demo.launch(share=False) |
| |
|