File size: 1,033 Bytes
a176aa6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import gradio as gr
from Backend.OCR.Dynamic.VideoOCR import gradio_video_ocr_processing
def createVideoOcrInterface():
    """
    Create an interface for OCR in a video.

    The interface allows users to upload a video, and the model will return an annotated video with bounding boxes and detected text.
    """
    return gr.Interface(
        fn=gradio_video_ocr_processing, 
        inputs=gr.Video(label="Upload Video File (.mp4)"), 
        outputs=[
            gr.Video(label="Annotated Video"),
            gr.Textbox(label="Gemini Full Response"),
            gr.JSON(label="Parsed Output")
        ],
        title="OCR in Video",
        description=(
            "Upload a video for OCR. The model will process the video "
            "and return an annotated version with bounding boxes and detected text."
            "It will also process the text with Gemini LLM for manufacturing, expiry date and MRP predictions."
        ),
        examples=None,  
        allow_flagging="never", 
        live=False,  
    )