Update app.py
Browse files
app.py
CHANGED
|
@@ -23,13 +23,13 @@ dtype = torch.float16
|
|
| 23 |
example_images = ["00000174_003.png", "00006596_000.png", "00006663_000.png",
|
| 24 |
"00012976_002.png", "00018401_000.png", "00019799_000.png"]
|
| 25 |
|
| 26 |
-
processor = AutoProcessor.from_pretrained("
|
| 27 |
-
generation_config = GenerationConfig.from_pretrained("
|
| 28 |
# model = AutoModelForCausalLM.from_pretrained("StanfordAIMI/CheXagent-8b", torch_dtype=dtype, trust_remote_code=True)
|
| 29 |
|
| 30 |
@spaces.GPU
|
| 31 |
def generate(image, prompt):
|
| 32 |
-
model = AutoModelForCausalLM.from_pretrained("
|
| 33 |
if hasattr(image, "read"):
|
| 34 |
image = Image.open(io.BytesIO(image.read())).convert("RGB")
|
| 35 |
else:
|
|
|
|
| 23 |
example_images = ["00000174_003.png", "00006596_000.png", "00006663_000.png",
|
| 24 |
"00012976_002.png", "00018401_000.png", "00019799_000.png"]
|
| 25 |
|
| 26 |
+
processor = AutoProcessor.from_pretrained("liuhaotian/llava-v1.6-mistral-7b", trust_remote_code=True)
|
| 27 |
+
generation_config = GenerationConfig.from_pretrained("liuhaotian/llava-v1.6-mistral-7b")
|
| 28 |
# model = AutoModelForCausalLM.from_pretrained("StanfordAIMI/CheXagent-8b", torch_dtype=dtype, trust_remote_code=True)
|
| 29 |
|
| 30 |
@spaces.GPU
|
| 31 |
def generate(image, prompt):
|
| 32 |
+
model = AutoModelForCausalLM.from_pretrained("liuhaotian/llava-v1.6-mistral-7b", torch_dtype=dtype, trust_remote_code=True).to(device)
|
| 33 |
if hasattr(image, "read"):
|
| 34 |
image = Image.open(io.BytesIO(image.read())).convert("RGB")
|
| 35 |
else:
|