LukasHug commited on
Commit
b95dd01
·
verified ·
1 Parent(s): 38b0be0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -3,14 +3,11 @@ import os
3
  import argparse
4
  import time
5
  import subprocess
6
- if '/workspace' not in sys.path:
7
- sys.path.append('/workspace')
8
- import gradio_web_server as gws
9
- # from llavaguard.hf_utils import set_up_env_and_token
10
 
 
11
 
12
  # Execute the pip install command with additional options
13
- # subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'flash-attn', '--no-build-isolation', '-U'])
14
 
15
 
16
  def start_controller():
@@ -84,6 +81,15 @@ Set the environment variable `model` to change the model:
84
  # set the huggingface login token
85
  controller_proc = start_controller()
86
  concurrency_count = int(os.getenv("concurrency_count", 5))
 
 
 
 
 
 
 
 
 
87
 
88
  models = [
89
  'LukasHug/LlavaGuard-7B-hf',
 
3
  import argparse
4
  import time
5
  import subprocess
 
 
 
 
6
 
7
+ import gradio_web_server as gws
8
 
9
  # Execute the pip install command with additional options
10
+ subprocess.check_call([sys.executable, '-m', 'pip', 'install', 'flash-attn', '--no-build-isolation', '-U'])
11
 
12
 
13
  def start_controller():
 
81
  # set the huggingface login token
82
  controller_proc = start_controller()
83
  concurrency_count = int(os.getenv("concurrency_count", 5))
84
+ api_key = os.getenv("token")
85
+ if api_key:
86
+ cmd = f"huggingface-cli login --token {api_key} --add-to-git-credential"
87
+ os.system(cmd)
88
+ else:
89
+ if '/workspace' not in sys.path:
90
+ sys.path.append('/workspace')
91
+ from llavaguard.hf_utils import set_up_env_and_token
92
+ set_up_env_and_token(read=True, write=False)
93
 
94
  models = [
95
  'LukasHug/LlavaGuard-7B-hf',