Tonic commited on
Commit
14692c9
·
1 Parent(s): 40254ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -2
app.py CHANGED
@@ -1,3 +1,14 @@
1
- import gradio_client as grc
2
- grc.Client("TeamTonic/coherebot").deploy_discord(api_names=["predict"])
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"])