Spaces:
Running on Zero
Running on Zero
Commit Β·
cac01bb
1
Parent(s): 7a4a029
Summary
Browse filesFiles changed (7)
123456730 unmodified lines383940.noti_err {color: var(--color-accent);}.noti_true {color: #006900;}30 unmodified linesdiv.sent-stats:hover label[data-testid="block-label"] {display: none;}12345678930 unmodified lines4041424344454647484950.noti_err,div.noti-results-false textarea {color: var(--color-accent);}.noti_true,div.noti-results-true textarea {color: #006900;}30 unmodified linesdiv.sent-stats:hover label[data-testid="block-label"] {display: none;}div.noti-results textarea,div.noti-results-false textarea,div.noti-results-true textarea {height: fit-content;font-weight: bold;font-size: 16px;}
8 unmodified lines9101112131415161718192021222324252627288 unmodified lines# Importing necessary components for the Gradio appfrom app.config import config_datafrom app.components import html_messagedef event_handler_clear() -> (tuple[gr.Video, gr.Button, gr.Button, gr.HTML, gr.Plot, gr.Plot, gr.Plot, gr.Plot]):return (gr.Video(value=None),gr.Button(interactive=False),gr.Button(interactive=False),html_message(message=config_data.InformationMessages_NOTI_RESULTS[0],error=True,visible=True,),gr.Plot(value=None, visible=False),gr.Plot(value=None, visible=False),8 unmodified lines91011121314151617181920212223242526272829308 unmodified lines# Importing necessary components for the Gradio appfrom app.config import config_datadef event_handler_clear() -> (tuple[gr.Video, gr.Button, gr.Button, gr.Textbox, gr.Plot, gr.Plot, gr.Plot, gr.Plot]):return (gr.Video(value=None),gr.Button(interactive=False),gr.Button(interactive=False),gr.Textbox(value=config_data.InformationMessages_NOTI_RESULTS[0],info=None,container=False,elem_classes="noti-results-false",),gr.Plot(value=None, visible=False),gr.Plot(value=None, visible=False),
16 unmodified lines171819202122233 unmodified lines272829303132331 unmodified line353637383940419 unmodified lines5152535455565716 unmodified linesvideo,clear,submit,noti_results,waveform,faces,emotion_stats,3 unmodified linestriggers=[video.change, video.upload, video.stop_recording, video.clear],fn=event_handler_video,inputs=[video],outputs=[clear, submit, noti_results],queue=True,)1 unmodified linefn=event_handler_submit,inputs=[video],outputs=[noti_results,waveform,faces,emotion_stats,9 unmodified linesvideo,clear,submit,noti_results,waveform,faces,emotion_stats,16 unmodified lines171819202122233 unmodified lines272829303132331 unmodified line353637383940419 unmodified lines5152535455565716 unmodified linesvideo,clear,submit,text,waveform,faces,emotion_stats,3 unmodified linestriggers=[video.change, video.upload, video.stop_recording, video.clear],fn=event_handler_video,inputs=[video],outputs=[clear, submit, text],queue=True,)1 unmodified linefn=event_handler_submit,inputs=[video],outputs=[text,waveform,faces,emotion_stats,9 unmodified linesvideo,clear,submit,text,waveform,faces,emotion_stats,
38 unmodified lines39404142434445464748495051115 unmodified lines16716816917017117217317417517638 unmodified linestext_model,)from app.load_models import VideoFeatureExtractorfrom app.components import html_message@spaces.GPUdef event_handler_submit(video: str,) -> tuple[gr.HTML, gr.Plot, gr.Plot, gr.Plot, gr.Plot]:if video:if video.split(".")[-1] == "webm":video = convert_webm_to_mp4(video)115 unmodified lines)return (html_message(message=config_data.InformationMessages_NOTI_RESULTS[1],error=False,visible=False,),gr.Plot(value=plt_audio, visible=True),gr.Plot(value=plt_faces, visible=True),38 unmodified lines394041424344454647484950115 unmodified lines16616716816917017117217317417517638 unmodified linestext_model,)from app.load_models import VideoFeatureExtractor@spaces.GPUdef event_handler_submit(video: str,) -> tuple[gr.Textbox, gr.Plot, gr.Plot, gr.Plot, gr.Plot]:if video:if video.split(".")[-1] == "webm":video = convert_webm_to_mp4(video)115 unmodified lines)return (gr.Textbox(value=" ".join(total_text).strip(),info=config_data.InformationMessages_REC_TEXT,container=False,elem_classes="noti-results",),gr.Plot(value=plt_audio, visible=True),gr.Plot(value=plt_faces, visible=True),
8 unmodified lines910111213141516171819202122232425268 unmodified lines# Importing necessary components for the Gradio appfrom app.config import config_datafrom app.components import html_messagedef event_handler_video(video: str) -> gr.HTML:is_video_valid = bool(video)return (gr.Button(interactive=is_video_valid),gr.Button(interactive=is_video_valid),html_message(message=config_data.InformationMessages_NOTI_RESULTS[int(is_video_valid)],error=not is_video_valid,visible=True,),)8 unmodified lines910111213141516171819202122232425268 unmodified lines# Importing necessary components for the Gradio appfrom app.config import config_datadef event_handler_video(video: str) -> tuple[gr.Button, gr.Button, gr.Textbox]:is_video_valid = bool(video)return (gr.Button(interactive=is_video_valid),gr.Button(interactive=is_video_valid),gr.Textbox(value=config_data.InformationMessages_NOTI_RESULTS[int(is_video_valid)],info=None,container=False,elem_classes="noti-results-" + str(is_video_valid).lower(),),)
9 unmodified lines1011121314151648 unmodified lines656667686970717273747576771 unmodified line7980818283848586878832 unmodified lines1211221231241251261279 unmodified lines# Importing necessary components for the Gradio appfrom app.description import DESCRIPTIONfrom app.config import config_datafrom app.components import html_messagefrom app.requirements_app import read_requirements48 unmodified lineselem_classes="submit",)gr.Examples(["videos/1.mp4","videos/2.mp4",],[video],)with gr.Column(visible=True,1 unmodified linevariant="default",elem_classes="results-container",):noti_results = html_message(message=config_data.InformationMessages_NOTI_RESULTS[0],error=True,visible=True,)waveform = gr.Plot(32 unmodified linesvideo,clear,submit,noti_results,waveform,faces,emotion_stats,9 unmodified lines10111213141548 unmodified lines646566676869701 unmodified line727374757677787980818283848586878889909192939432 unmodified lines1271281291301311321339 unmodified lines# Importing necessary components for the Gradio appfrom app.description import DESCRIPTIONfrom app.config import config_datafrom app.requirements_app import read_requirements48 unmodified lineselem_classes="submit",)gr.Examples(config_data.StaticPaths_EXAMPLES, [video])with gr.Column(visible=True,1 unmodified linevariant="default",elem_classes="results-container",):text = gr.Textbox(value=config_data.InformationMessages_NOTI_RESULTS[0],max_lines=10,placeholder=None,label=None,info=None,show_label=False,container=False,interactive=False,visible=True,autofocus=False,autoscroll=True,render=True,type="text",show_copy_button=False,max_length=config_data.General_TEXT_MAX_LENGTH,elem_classes="noti-results-false",)waveform = gr.Plot(32 unmodified linesvideo,clear,submit,text,waveform,faces,emotion_stats,
2 unmodified lines34567819 unmodified lines28293031323325 unmodified lines5960616263642 unmodified linesCSS_PATH = "app.css"[General]SR = 16000START_TIME = 0WIN_MAX_LENGTH = 419 unmodified lines"Upload or record video","Video uploaded, you can perform calculations",][OtherMessages]CLEAR = "Clear"25 unmodified linesEMO_SENT_VIDEO_WEIGHTS = "emo_sent_video_weights.pth"YOLOV8N_FACE = "yolov8n-face.pt"OPENAI_WHISPER = "openai/whisper-base"[Requirements]LIBRARY = "Library"2 unmodified lines345678919 unmodified lines2930313233343525 unmodified lines616263646566676869702 unmodified linesCSS_PATH = "app.css"[General]TEXT_MAX_LENGTH = 1000SR = 16000START_TIME = 0WIN_MAX_LENGTH = 419 unmodified lines"Upload or record video","Video uploaded, you can perform calculations",]REC_TEXT = "Recognized text"[OtherMessages]CLEAR = "Clear"25 unmodified linesEMO_SENT_VIDEO_WEIGHTS = "emo_sent_video_weights.pth"YOLOV8N_FACE = "yolov8n-face.pt"OPENAI_WHISPER = "openai/whisper-base"EXAMPLES = ["videos/1.mp4","videos/2.mp4",][Requirements]LIBRARY = "Library"
app.css+12-2
app/event_handlers/clear.py+8-6
app/event_handlers/event_handlers.py+4-4
app/event_handlers/submit.py+6-6
app/event_handlers/video.py+6-6
app/tabs.py+18-12
config.toml+6