File size: 1,685 Bytes
e52a7fb
 
 
 
 
7137256
 
e52a7fb
 
 
 
 
 
 
 
7137256
e52a7fb
7137256
 
 
 
 
 
 
 
 
8d70ec1
7137256
 
 
 
8d70ec1
7137256
 
e52a7fb
 
 
 
7137256
 
 
 
 
 
 
 
 
e52a7fb
 
 
7137256
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import gradio as gr
import app_backend

gr.set_static_paths(['.'])

def detect_crashes(name, sim_files, real_files, frame_out, text_output, file_out, video_out):
    for outputs in app_backend.backend(name, sim_files, real_files, frame_out, text_output, file_out, video_out):
        yield outputs

with gr.Blocks(title="Drone Crash Detection") as demo:
    text_output = gr.Textbox(interactive=False)
    frame_output = gr.Image(interactive=False)
    video_output = gr.Gallery(interactive=False)
    file_output = gr.File(interactive=False)

    label = gr.Label("Drone Crash Classification Using Yolov8.", scale=0, show_label=False)

    student_name_tb = gr.Textbox(
        lines=1, 
        placeholder="Enter student's name. Ex: 'First Last'", 
        visible=True, 
        show_label=True, 
        label="Student's Name"
    )
    simulation_videos_upload = gr.File(
        label="Upload Simulation Drone Videos", 
        type="filepath",  # Changed 'file' to 'filepath'
        file_count="multiple"
    )
    real_videos_upload = gr.File(
        label="Upload Real Drone Videos", 
        type="filepath",  # Changed 'file' to 'filepath'
        file_count="multiple"
    )
    with gr.Row():
        btn_prompt = gr.Button("Detect Crashes")
        btn_prompt.click(
            fn=detect_crashes,
            inputs=[
                student_name_tb, 
                simulation_videos_upload, 
                real_videos_upload, 
                frame_output, 
                text_output, 
                file_output, 
                video_output
            ],
            outputs=[frame_output, text_output, file_output, video_output]
        )

demo.launch()