Update app.py
Browse files
app.py
CHANGED
|
@@ -20,7 +20,7 @@ model = YOLOv10.from_pretrained('jameslahm/yolov10x').to(device)
|
|
| 20 |
|
| 21 |
model_id = "meta-llama/Llama-3.2-11B-Vision-Instruct"
|
| 22 |
|
| 23 |
-
|
| 24 |
model_id,
|
| 25 |
torch_dtype=torch.bfloat16,
|
| 26 |
device_map="auto",
|
|
@@ -29,7 +29,7 @@ processor = AutoProcessor.from_pretrained(model_id)
|
|
| 29 |
|
| 30 |
|
| 31 |
model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
|
| 32 |
-
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 34 |
|
| 35 |
|
|
@@ -81,7 +81,7 @@ def generate_image_desc(image):
|
|
| 81 |
inputs = processor(image, input_text, return_tensors="pt").to(model.device)
|
| 82 |
|
| 83 |
# Generate the output from the model
|
| 84 |
-
output =
|
| 85 |
print(output)
|
| 86 |
markdown_text = processor.decode(output[0])
|
| 87 |
print(markdown_text)
|
|
|
|
| 20 |
|
| 21 |
model_id = "meta-llama/Llama-3.2-11B-Vision-Instruct"
|
| 22 |
|
| 23 |
+
model_vision = MllamaForConditionalGeneration.from_pretrained(
|
| 24 |
model_id,
|
| 25 |
torch_dtype=torch.bfloat16,
|
| 26 |
device_map="auto",
|
|
|
|
| 29 |
|
| 30 |
|
| 31 |
model_name = "Qwen/Qwen2.5-Coder-7B-Instruct"
|
| 32 |
+
model_code = AutoModelForCausalLM.from_pretrained(model_name, torch_dtype="auto", device_map="auto")
|
| 33 |
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
| 34 |
|
| 35 |
|
|
|
|
| 81 |
inputs = processor(image, input_text, return_tensors="pt").to(model.device)
|
| 82 |
|
| 83 |
# Generate the output from the model
|
| 84 |
+
output = model_vision.generate(**inputs, max_new_tokens=300)
|
| 85 |
print(output)
|
| 86 |
markdown_text = processor.decode(output[0])
|
| 87 |
print(markdown_text)
|