Spaces:
Sleeping
Sleeping
Jon Taylor
commited on
Commit
•
fcfd230
1
Parent(s):
0ce0c17
fixed dockerfile
Browse files- README.md +1 -1
- app/bot.py +1 -1
- env.example +4 -3
- frontend/app/page.js +24 -4
README.md
CHANGED
@@ -14,4 +14,4 @@ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-
|
|
14 |
## Local docker build
|
15 |
|
16 |
docker build -t username/appname:0.0 .
|
17 |
-
docker run -p 8000:7860 --env-file .env
|
|
|
14 |
## Local docker build
|
15 |
|
16 |
docker build -t username/appname:0.0 .
|
17 |
+
docker run -p 8000:7860 --env-file .env username/appname:0.0
|
app/bot.py
CHANGED
@@ -150,7 +150,7 @@ def main():
|
|
150 |
parser.add_argument("-t", "--private", type=bool, help="Is this room private?", default=True)
|
151 |
parser.add_argument("-n", "--bot-name", type=str, help="Name of the bot", default="Daily Bot")
|
152 |
parser.add_argument("-e", "--expiration", type=int, help="Duration of bot", default=os.getenv("BOT_MAX_DURATION", 300))
|
153 |
-
parser.add_argument("-i", "--idle", type=bool, help="Wait for participants to join", default=False)
|
154 |
args = parser.parse_args()
|
155 |
|
156 |
Daily.init()
|
|
|
150 |
parser.add_argument("-t", "--private", type=bool, help="Is this room private?", default=True)
|
151 |
parser.add_argument("-n", "--bot-name", type=str, help="Name of the bot", default="Daily Bot")
|
152 |
parser.add_argument("-e", "--expiration", type=int, help="Duration of bot", default=os.getenv("BOT_MAX_DURATION", 300))
|
153 |
+
parser.add_argument("-i", "--idle", type=bool, help="Wait for participants to join", default=os.getenv("BOT_WILL_IDLE", False))
|
154 |
args = parser.parse_args()
|
155 |
|
156 |
Daily.init()
|
env.example
CHANGED
@@ -2,6 +2,7 @@ DAILY_API_PATH=https://api.daily.co/v1
|
|
2 |
DAILY_API_KEY=
|
3 |
DAILY_ROOM_URL=
|
4 |
BOT_MAX_DURATION=300
|
5 |
-
SAFETY_CHECKER=
|
6 |
-
TORCH_COMPILE=
|
7 |
-
USE_TAESD=
|
|
|
|
2 |
DAILY_API_KEY=
|
3 |
DAILY_ROOM_URL=
|
4 |
BOT_MAX_DURATION=300
|
5 |
+
SAFETY_CHECKER=1
|
6 |
+
TORCH_COMPILE=1
|
7 |
+
USE_TAESD=1
|
8 |
+
BOT_WILL_IDLE=1
|
frontend/app/page.js
CHANGED
@@ -1,9 +1,14 @@
|
|
1 |
"use client";
|
2 |
|
3 |
import Link from "next/link";
|
|
|
4 |
|
5 |
export default function Home() {
|
|
|
|
|
|
|
6 |
async function start() {
|
|
|
7 |
const resp = await fetch(
|
8 |
`${process.env.API_URL || "http://localhost:8000"}/start`,
|
9 |
{
|
@@ -19,14 +24,29 @@ export default function Home() {
|
|
19 |
);
|
20 |
|
21 |
const data = await resp.json();
|
22 |
-
|
|
|
23 |
}
|
24 |
|
25 |
return (
|
26 |
<main className="flex min-h-screen flex-col items-center justify-between p-24">
|
27 |
-
|
28 |
-
|
29 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
</main>
|
31 |
);
|
32 |
}
|
|
|
1 |
"use client";
|
2 |
|
3 |
import Link from "next/link";
|
4 |
+
import { useState } from "react";
|
5 |
|
6 |
export default function Home() {
|
7 |
+
const [starting, setStarting] = useState(false);
|
8 |
+
const [roomUrl, setRoomUrl] = useState();
|
9 |
+
|
10 |
async function start() {
|
11 |
+
setStarting(true);
|
12 |
const resp = await fetch(
|
13 |
`${process.env.API_URL || "http://localhost:8000"}/start`,
|
14 |
{
|
|
|
24 |
);
|
25 |
|
26 |
const data = await resp.json();
|
27 |
+
|
28 |
+
setRoomUrl(data.room_url);
|
29 |
}
|
30 |
|
31 |
return (
|
32 |
<main className="flex min-h-screen flex-col items-center justify-between p-24">
|
33 |
+
{!starting ? (
|
34 |
+
<button
|
35 |
+
onClick={() => start()}
|
36 |
+
disabled={starting}
|
37 |
+
className="bg-white text-black rounded-xl p-4 px-6"
|
38 |
+
>
|
39 |
+
Connect
|
40 |
+
</button>
|
41 |
+
) : (
|
42 |
+
<div>
|
43 |
+
{roomUrl ? (
|
44 |
+
<Link href={roomUrl}>Open Room</Link>
|
45 |
+
) : (
|
46 |
+
"Waiting for bot to load..."
|
47 |
+
)}
|
48 |
+
</div>
|
49 |
+
)}
|
50 |
</main>
|
51 |
);
|
52 |
}
|