hgdgng commited on
Commit
792e4dd
1 Parent(s): d35db82

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -2
app.py CHANGED
@@ -1,5 +1,6 @@
1
- from transformers import MllamaForConditionalGeneration, AutoProcessor, TextIteratorStreamer
2
  from PIL import Image
 
3
  import requests
4
  import torch
5
  from threading import Thread
@@ -7,11 +8,17 @@ import gradio as gr
7
  from gradio import FileData
8
  import time
9
  import spaces
 
 
 
 
10
  ckpt = "meta-llama/Llama-3.2-11B-Vision-Instruct"
 
11
  model = MllamaForConditionalGeneration.from_pretrained(ckpt,
12
  torch_dtype=torch.bfloat16).to("cuda")
13
  processor = AutoProcessor.from_pretrained(ckpt)
14
- tokenizer = AutoTokenizer.from_pretrained( "meta-llama/Llama-3.2-11B-Vision-Instruct", token=HGHugging )
 
15
 
16
  @spaces.GPU
17
  def bot_streaming(message, history, max_new_tokens=250):
 
1
+ from transformers import MllamaForConditionalGeneration, AutoProcessor, AutoTokenizer, TextIteratorStreamer, AutoModelForCasualLM
2
  from PIL import Image
3
+ import os
4
  import requests
5
  import torch
6
  from threading import Thread
 
8
  from gradio import FileData
9
  import time
10
  import spaces
11
+
12
+
13
+ hf_token = os.environ.get("HGHugging")
14
+
15
  ckpt = "meta-llama/Llama-3.2-11B-Vision-Instruct"
16
+
17
  model = MllamaForConditionalGeneration.from_pretrained(ckpt,
18
  torch_dtype=torch.bfloat16).to("cuda")
19
  processor = AutoProcessor.from_pretrained(ckpt)
20
+ tokenizer = AutoTokenizer.from_pretrained( "meta-llama/Llama-3.2-11B-Vision-Instruct", token=hf_token )
21
+
22
 
23
  @spaces.GPU
24
  def bot_streaming(message, history, max_new_tokens=250):