LukasHug commited on
Commit
5fc41f0
1 Parent(s): 1342a94

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -3
app.py CHANGED
@@ -260,6 +260,11 @@ def llava_bot(state, model_selector, temperature, top_p, max_new_tokens, request
260
  if not os.path.isfile(filename):
261
  os.makedirs(os.path.dirname(filename), exist_ok=True)
262
  image.save(filename)
 
 
 
 
 
263
 
264
  output = run_llava(prompt, all_images[0], temperature, top_p, max_new_tokens)
265
 
@@ -502,8 +507,7 @@ Set the environment variable `model` to change the model:
502
  'LukasHug/LlavaGuard-13B-hf',
503
  'LukasHug/LlavaGuard-34B-hf', ]
504
  bits = int(os.getenv("bits", 16))
505
- model = os.getenv("model", models[1])
506
- available_devices = os.getenv("CUDA_VISIBLE_DEVICES", "0")
507
  model_path, model_name = model, model.split("/")[0]
508
  if api_key:
509
  cmd = f"huggingface-cli login --token {api_key} --add-to-git-credential"
@@ -535,4 +539,4 @@ Set the environment variable `model` to change the model:
535
  print(e)
536
  exit_status = 1
537
  finally:
538
- sys.exit(exit_status)
 
260
  if not os.path.isfile(filename):
261
  os.makedirs(os.path.dirname(filename), exist_ok=True)
262
  image.save(filename)
263
+ # check if model is not None
264
+ if model is None or tokenizer is None:
265
+ print(model)
266
+ print(tokenizer)
267
+
268
 
269
  output = run_llava(prompt, all_images[0], temperature, top_p, max_new_tokens)
270
 
 
507
  'LukasHug/LlavaGuard-13B-hf',
508
  'LukasHug/LlavaGuard-34B-hf', ]
509
  bits = int(os.getenv("bits", 16))
510
+ model = os.getenv("model", models[0])
 
511
  model_path, model_name = model, model.split("/")[0]
512
  if api_key:
513
  cmd = f"huggingface-cli login --token {api_key} --add-to-git-credential"
 
539
  print(e)
540
  exit_status = 1
541
  finally:
542
+ sys.exit(exit_status)