* Docs

* code
This commit is contained in:
Freddy Boulton
2024-11-18 14:06:46 -05:00
committed by GitHub
parent d7acdd7eb4
commit 2434a65747
12 changed files with 575 additions and 3 deletions

24
docs/deployment.md Normal file
View File

@@ -0,0 +1,24 @@
When deploying in a cloud environment (like Hugging Face Spaces, EC2, etc), you need to set up a TURN server to relay the WebRTC traffic.
The easiest way to do this is to use a service like Twilio.
```python
from twilio.rest import Client
import os
account_sid = os.environ.get("TWILIO_ACCOUNT_SID")
auth_token = os.environ.get("TWILIO_AUTH_TOKEN")
client = Client(account_sid, auth_token)
token = client.tokens.create()
rtc_configuration = {
"iceServers": token.ice_servers,
"iceTransportPolicy": "relay",
}
with gr.Blocks() as demo:
...
rtc = WebRTC(rtc_configuration=rtc_configuration, ...)
...
```