Update app.py
Browse files
app.py
CHANGED
@@ -1,3 +1,14 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import gradio as gr
|
3 |
|
4 |
+
# Access environment variables
|
5 |
+
hf_token = os.environ.get("HF_TOKEN")
|
6 |
+
inference_endpoint = os.environ.get("INFERENCE_ENDPOINT")
|
7 |
+
|
8 |
+
# Check if the environment variables are set
|
9 |
+
if hf_token is None or inference_endpoint is None:
|
10 |
+
raise ValueError("HF_TOKEN or INFERENCE_ENDPOINT environment variable not set")
|
11 |
+
|
12 |
+
secrets = {"HF_TOKEN": hf_token, "INFERENCE_ENDPOINT": inference_endpoint}
|
13 |
+
client = gr.Client.duplicate("gradio-discord-bots/falcon-7b-instruct", private=False, secrets=secrets, sleep_timeout=2880)
|
14 |
+
client.deploy_discord(api_names=["predict"])
|