Download app.py from Starchik1/cli: direct link, hf CLI and curl.
- Browser
- Download file 709 Bytes
-
https://huggingface.co/spaces/Starchik1/cli/resolve/main/app.py
- Command line
-
hf download hf://spaces/Starchik1/cli/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Starchik1/cli/resolve/main/app.py
709 Bytes
| import streamlit as st | |
| import websockets | |
| import asyncio | |
| # Адрес сервера WebSocket | |
| SERVER_URI = "ws://52.4.151.236:8501" | |
| # Заголовок и текст | |
| st.title("Голосовой чат через WebSocket") | |
| st.write("Отправляйте аудио данные для общения.") | |
| # Текстовое сообщение для отправки | |
| message = st.text_input("Введите сообщение:") | |
| async def send_message(message): | |
| async with websockets.connect(SERVER_URI) as websocket: | |
| await websocket.send(message) | |
| # Отправка сообщения | |
| if message: | |
| asyncio.run(send_message(message)) | |
| st.write(f"Отправлено: {message}") | |