Spaces:
Running
on
Zero
Running
on
Zero
Merge branch 'main' of https://huggingface.co/spaces/chenjoya/LiveCC
Browse files
app.py
CHANGED
@@ -25,7 +25,7 @@ with gr.Blocks() as demo:
|
|
25 |
gr.Markdown("1️⃣ Select Mode, Real-Time Commentary (LiveCC) or Conversation (Common QA)")
|
26 |
gr.Markdown("2️⃣🅰️ Real-Time Commentary: Input a query (optional) -> Click or upload a video.")
|
27 |
gr.Markdown("2️⃣🅱️ Conversation: Click or upload a video -> Input a query.")
|
28 |
-
gr.Markdown("*Web Gradio has unexpected latency (3s~5s). If you want to enjoy the very real-time experience, please
|
29 |
gr_state = gr.State({}, render=False) # control all useful state, including kv cache
|
30 |
gr_video_state = gr.JSON({}, visible=False) # only record video state, belong to gr_state but lightweight
|
31 |
gr_static_trigger = gr.Number(value=0, visible=False) # control start streaming or stop
|
@@ -45,10 +45,7 @@ with gr.Blocks() as demo:
|
|
45 |
gr_examples = gr.Examples(
|
46 |
examples=[
|
47 |
'demo/sources/howto_fix_laptop_mute_1080p.mp4',
|
48 |
-
|
49 |
-
# 'demo/sources/dota2_facelessvoid_mute_1080p.mp4',
|
50 |
-
# 'demo/sources/spacex_falcon9_mute_1080p.mp4',
|
51 |
-
# 'demo/sources/writing_mute_1080p.mp4'
|
52 |
],
|
53 |
inputs=[gr_video],
|
54 |
)
|
@@ -59,8 +56,6 @@ with gr.Blocks() as demo:
|
|
59 |
gr_radio_mode = gr.Radio(label="Select Mode", choices=["Real-Time Commentary", "Conversation"], elem_id="gr_radio_mode", value='Real-Time Commentary', interactive=True)
|
60 |
|
61 |
def gr_chatinterface_fn(message, history, state, video_path, mode):
|
62 |
-
if mode == 'Real-Time Commentary':
|
63 |
-
return gradio_backend.waiting_video_response, state
|
64 |
state['video_path'] = video_path
|
65 |
response, state = gradio_backend(query=message, state=state, mode=mode)
|
66 |
return response, state
|
|
|
25 |
gr.Markdown("1️⃣ Select Mode, Real-Time Commentary (LiveCC) or Conversation (Common QA)")
|
26 |
gr.Markdown("2️⃣🅰️ Real-Time Commentary: Input a query (optional) -> Click or upload a video.")
|
27 |
gr.Markdown("2️⃣🅱️ Conversation: Click or upload a video -> Input a query.")
|
28 |
+
gr.Markdown("*Web Gradio has unexpected latency (3s~5s). If you want to enjoy the very real-time experience, please deploy locally https://github.com/showlab/livecc*")
|
29 |
gr_state = gr.State({}, render=False) # control all useful state, including kv cache
|
30 |
gr_video_state = gr.JSON({}, visible=False) # only record video state, belong to gr_state but lightweight
|
31 |
gr_static_trigger = gr.Number(value=0, visible=False) # control start streaming or stop
|
|
|
45 |
gr_examples = gr.Examples(
|
46 |
examples=[
|
47 |
'demo/sources/howto_fix_laptop_mute_1080p.mp4',
|
48 |
+
'demo/sources/writing_mute_1080p.mp4'
|
|
|
|
|
|
|
49 |
],
|
50 |
inputs=[gr_video],
|
51 |
)
|
|
|
56 |
gr_radio_mode = gr.Radio(label="Select Mode", choices=["Real-Time Commentary", "Conversation"], elem_id="gr_radio_mode", value='Real-Time Commentary', interactive=True)
|
57 |
|
58 |
def gr_chatinterface_fn(message, history, state, video_path, mode):
|
|
|
|
|
59 |
state['video_path'] = video_path
|
60 |
response, state = gradio_backend(query=message, state=state, mode=mode)
|
61 |
return response, state
|