Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,28 +3,28 @@ import gradio as gr
|
|
| 3 |
|
| 4 |
from demo.infer import LiveCCDemoInfer
|
| 5 |
|
| 6 |
-
|
| 7 |
-
waiting_video_response = 'Waiting for video input...'
|
| 8 |
-
not_found_video_response = 'Video does not exist...'
|
| 9 |
-
mode2api = {
|
| 10 |
-
'Real-Time Commentary': 'live_cc',
|
| 11 |
-
'Conversation': 'video_qa'
|
| 12 |
-
}
|
| 13 |
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
|
|
|
|
|
|
| 24 |
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
|
| 27 |
-
with gr.Blocks() as demo:
|
| 28 |
gr.Markdown("## LiveCC Real-Time Commentary and Conversation - Gradio Demo")
|
| 29 |
gr.Markdown("### [LiveCC: Learning Video LLM with Streaming Speech Transcription at Scale (CVPR 2025)](https://showlab.github.io/livecc/)")
|
| 30 |
gr.Markdown("1️⃣ Select Mode, Real-Time Commentary (LiveCC) or Conversation (Common QA)")
|
|
|
|
| 3 |
|
| 4 |
from demo.infer import LiveCCDemoInfer
|
| 5 |
|
| 6 |
+
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
|
| 8 |
+
class GradioBackend:
|
| 9 |
+
waiting_video_response = 'Waiting for video input...'
|
| 10 |
+
not_found_video_response = 'Video does not exist...'
|
| 11 |
+
mode2api = {
|
| 12 |
+
'Real-Time Commentary': 'live_cc',
|
| 13 |
+
'Conversation': 'video_qa'
|
| 14 |
+
}
|
| 15 |
|
| 16 |
+
@spaces.GPU
|
| 17 |
+
def __init__(self, model_path: str = 'chenjoya/LiveCC-7B-Instruct'):
|
| 18 |
+
self.infer = LiveCCDemoInfer(model_path)
|
| 19 |
+
from kokoro import KPipeline
|
| 20 |
+
self.audio_pipeline = KPipeline(lang_code='a')
|
| 21 |
|
| 22 |
+
@spaces.GPU
|
| 23 |
+
def __call__(self, query: str = None, state: dict = {}, mode: str = 'Real-Time Commentary', **kwargs):
|
| 24 |
+
return getattr(self.infer, self.mode2api[mode])(query=query, state=state, **kwargs)
|
| 25 |
+
|
| 26 |
+
gradio_backend = GradioBackend()
|
| 27 |
|
|
|
|
| 28 |
gr.Markdown("## LiveCC Real-Time Commentary and Conversation - Gradio Demo")
|
| 29 |
gr.Markdown("### [LiveCC: Learning Video LLM with Streaming Speech Transcription at Scale (CVPR 2025)](https://showlab.github.io/livecc/)")
|
| 30 |
gr.Markdown("1️⃣ Select Mode, Real-Time Commentary (LiveCC) or Conversation (Common QA)")
|