Spaces:
Running
on
Zero
Running
on
Zero
fix
Browse files
app.py
CHANGED
@@ -1,3 +1,5 @@
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
|
3 |
from demo.infer import LiveCCDemoInfer
|
@@ -25,7 +27,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 +47,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 +58,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
|
|
|
1 |
+
import os
|
2 |
+
os.system('pip install flash-attn --no-build-isolation')
|
3 |
import gradio as gr
|
4 |
|
5 |
from demo.infer import LiveCCDemoInfer
|
|
|
27 |
gr.Markdown("1️⃣ Select Mode, Real-Time Commentary (LiveCC) or Conversation (Common QA)")
|
28 |
gr.Markdown("2️⃣🅰️ Real-Time Commentary: Input a query (optional) -> Click or upload a video.")
|
29 |
gr.Markdown("2️⃣🅱️ Conversation: Click or upload a video -> Input a query.")
|
30 |
+
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*")
|
31 |
gr_state = gr.State({}, render=False) # control all useful state, including kv cache
|
32 |
gr_video_state = gr.JSON({}, visible=False) # only record video state, belong to gr_state but lightweight
|
33 |
gr_static_trigger = gr.Number(value=0, visible=False) # control start streaming or stop
|
|
|
47 |
gr_examples = gr.Examples(
|
48 |
examples=[
|
49 |
'demo/sources/howto_fix_laptop_mute_1080p.mp4',
|
50 |
+
'demo/sources/writing_mute_1080p.mp4'
|
|
|
|
|
|
|
51 |
],
|
52 |
inputs=[gr_video],
|
53 |
)
|
|
|
58 |
gr_radio_mode = gr.Radio(label="Select Mode", choices=["Real-Time Commentary", "Conversation"], elem_id="gr_radio_mode", value='Real-Time Commentary', interactive=True)
|
59 |
|
60 |
def gr_chatinterface_fn(message, history, state, video_path, mode):
|
|
|
|
|
61 |
state['video_path'] = video_path
|
62 |
response, state = gradio_backend(query=message, state=state, mode=mode)
|
63 |
return response, state
|