Spaces:
Sleeping
Sleeping
phamngoctukts
commited on
Commit
•
e520e70
1
Parent(s):
a08e6fe
Update app.py
Browse files
app.py
CHANGED
@@ -15,8 +15,6 @@ from huggingface_hub import login
|
|
15 |
import os
|
16 |
from PIL import Image
|
17 |
from threading import Thread
|
18 |
-
tk = os.environ.get("HF_TOKEN")
|
19 |
-
#login(tk)
|
20 |
ckpt = "meta-llama/Llama-3.2-11B-Vision-Instruct"
|
21 |
model = MllamaForConditionalGeneration.from_pretrained(ckpt,torch_dtype=torch.bfloat16).to("cpu")
|
22 |
processor = AutoProcessor.from_pretrained(ckpt)
|
@@ -80,8 +78,10 @@ def process_audio(audio:tuple, image: Image, state:AppState):
|
|
80 |
else:
|
81 |
try:
|
82 |
if state.stream is None:
|
83 |
-
state.stream =
|
84 |
-
|
|
|
|
|
85 |
except IndexError:
|
86 |
print("Lỗi: Chỉ mục vượt quá giới hạn của audio. Kiểm tra kích thước của audio.")
|
87 |
if image is None:
|
|
|
15 |
import os
|
16 |
from PIL import Image
|
17 |
from threading import Thread
|
|
|
|
|
18 |
ckpt = "meta-llama/Llama-3.2-11B-Vision-Instruct"
|
19 |
model = MllamaForConditionalGeneration.from_pretrained(ckpt,torch_dtype=torch.bfloat16).to("cpu")
|
20 |
processor = AutoProcessor.from_pretrained(ckpt)
|
|
|
78 |
else:
|
79 |
try:
|
80 |
if state.stream is None:
|
81 |
+
state.stream = audio[1]
|
82 |
+
state.sampling_rate = audio[0]
|
83 |
+
else:
|
84 |
+
state.stream = np.concatenate((state.stream, audio[1]))
|
85 |
except IndexError:
|
86 |
print("Lỗi: Chỉ mục vượt quá giới hạn của audio. Kiểm tra kích thước của audio.")
|
87 |
if image is None:
|