mirror of
https://github.com/HumanAIGC-Engineering/gradio-webrtc.git
synced 2026-02-05 09:59:22 +08:00
Add text mode (#321)
* Pretty good spot * Working draft * Fix other mode * Add js to git * Working * Add code * fix * Fix * Add code * Fix submit race condition * demo * fix * Fix * Fix
This commit is contained in:
@@ -17,6 +17,7 @@ import av
|
||||
import librosa
|
||||
import numpy as np
|
||||
from fastapi import WebSocket
|
||||
from gradio.data_classes import GradioModel, GradioRootModel
|
||||
from numpy.typing import NDArray
|
||||
from pydub import AudioSegment
|
||||
|
||||
@@ -31,6 +32,16 @@ class AudioChunk(TypedDict):
|
||||
end: int
|
||||
|
||||
|
||||
class WebRTCData(GradioModel):
|
||||
webrtc_id: str
|
||||
textbox: str = ""
|
||||
audio: Any | None = None
|
||||
|
||||
|
||||
class WebRTCModel(GradioRootModel):
|
||||
root: WebRTCData | str
|
||||
|
||||
|
||||
class AdditionalOutputs:
|
||||
def __init__(self, *args) -> None:
|
||||
self.args = args
|
||||
|
||||
Reference in New Issue
Block a user