praysimanjuntak commited on
Commit
d3e4926
1 Parent(s): becc872

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -14,6 +14,10 @@ from llava.mm_utils import tokenizer_image_token
14
  from transformers.generation.streamers import TextIteratorStreamer
15
  import spaces
16
 
 
 
 
 
17
  def load_image(image_file):
18
  if image_file.startswith('http') or image_file.startswith('https'):
19
  response = requests.get(image_file)
@@ -24,10 +28,6 @@ def load_image(image_file):
24
 
25
  @spaces.GPU
26
  def bot_streaming(message, history):
27
- device = "cuda:0"
28
- tokenizer, model, image_processor, context_len = load_pretrained_model(model_path="./checkpoints/llava-phi3-3.8b-lora", model_name="llava-phi3-3.8b-lora", model_base="microsoft/Phi-3-mini-128k-instruct", load_8bit=False, load_4bit=False, device=device)
29
- model.to(device)
30
-
31
  if message["files"]:
32
  # message["files"][-1] is a Dict or just a string
33
  if type(message["files"][-1]) == dict:
 
14
  from transformers.generation.streamers import TextIteratorStreamer
15
  import spaces
16
 
17
+ device = "cuda:0"
18
+ tokenizer, model, image_processor, context_len = load_pretrained_model(model_path="./checkpoints/llava-phi3-3.8b-lora", model_name="llava-phi3-3.8b-lora", model_base="microsoft/Phi-3-mini-128k-instruct", load_8bit=False, load_4bit=False, device=device)
19
+ model.to(device)
20
+
21
  def load_image(image_file):
22
  if image_file.startswith('http') or image_file.startswith('https'):
23
  response = requests.get(image_file)
 
28
 
29
  @spaces.GPU
30
  def bot_streaming(message, history):
 
 
 
 
31
  if message["files"]:
32
  # message["files"][-1] is a Dict or just a string
33
  if type(message["files"][-1]) == dict: