Download HumeGradioStream.py from testdump1/confusion: direct link, hf CLI and curl.
- Browser
- Download file 1.01 kB
-
https://huggingface.co/testdump1/confusion/resolve/main/HumeGradioStream.py
- Command line
-
hf download hf://testdump1/confusion/HumeGradioStream.py
-
curl -L -o HumeGradioStream.py https://huggingface.co/testdump1/confusion/resolve/main/HumeGradioStream.py
1.01 kB
| from hume import HumeStreamClient | |
| from hume.models.config import FaceConfig | |
| from hume.models.config import ProsodyConfig | |
| import gradio as gr | |
| import asyncio | |
| async def HumeStream(client_key, video_file): | |
| newOpenTimeOut = 3000 | |
| newCloseTimeOut = 3000 | |
| client = HumeStreamClient(client_key, open_timeout=newOpenTimeOut, close_timeout=newCloseTimeOut) | |
| file = video_file | |
| configs = [FaceConfig(identify_faces=True), ProsodyConfig()] | |
| async with client.connect(configs) as socket: | |
| result = await socket.send_file(file) | |
| return result | |
| interface = gr.Interface( # inputs key, and video file #outputs: prediction json | |
| fn = HumeStream, | |
| inputs = ["text", gr.Video(label = "Video to analyze", format="mp4")], #client key, video file | |
| outputs = ["text"],# for predictions in JSON | |
| description = "Enter a video for emotion analysis" | |
| ).launch(share=True, auth=("jet", "pass"), auth_message="check your email for username and password") | |