Update app.py
Browse files
app.py
CHANGED
|
@@ -32,14 +32,14 @@ processor = AutoProcessor.from_pretrained(BASE_MODEL_ID)
|
|
| 32 |
print(f"[INFO] Loading Base Model: {BASE_MODEL_ID}")
|
| 33 |
base_model = AutoModelForImageTextToText.from_pretrained(
|
| 34 |
BASE_MODEL_ID,
|
| 35 |
-
torch_dtype=torch.
|
| 36 |
_attn_implementation="eager"
|
| 37 |
).eval()
|
| 38 |
|
| 39 |
print(f"[INFO] Loading Fine-tuned Model: {FINE_TUNED_MODEL_ID}")
|
| 40 |
ft_model = AutoModelForImageTextToText.from_pretrained(
|
| 41 |
FINE_TUNED_MODEL_ID,
|
| 42 |
-
torch_dtype=torch.
|
| 43 |
_attn_implementation="eager"
|
| 44 |
).eval()
|
| 45 |
|
|
@@ -48,7 +48,7 @@ def extract_foods_from_image(input_image):
|
|
| 48 |
if input_image is None:
|
| 49 |
return "Please upload an image", "Please upload an image"
|
| 50 |
|
| 51 |
-
input_image = input_image.resize((512, 512))
|
| 52 |
|
| 53 |
messages = [
|
| 54 |
{
|
|
|
|
| 32 |
print(f"[INFO] Loading Base Model: {BASE_MODEL_ID}")
|
| 33 |
base_model = AutoModelForImageTextToText.from_pretrained(
|
| 34 |
BASE_MODEL_ID,
|
| 35 |
+
torch_dtype=torch.float16,
|
| 36 |
_attn_implementation="eager"
|
| 37 |
).eval()
|
| 38 |
|
| 39 |
print(f"[INFO] Loading Fine-tuned Model: {FINE_TUNED_MODEL_ID}")
|
| 40 |
ft_model = AutoModelForImageTextToText.from_pretrained(
|
| 41 |
FINE_TUNED_MODEL_ID,
|
| 42 |
+
torch_dtype=torch.float16,
|
| 43 |
_attn_implementation="eager"
|
| 44 |
).eval()
|
| 45 |
|
|
|
|
| 48 |
if input_image is None:
|
| 49 |
return "Please upload an image", "Please upload an image"
|
| 50 |
|
| 51 |
+
#input_image = input_image.resize((512, 512))
|
| 52 |
|
| 53 |
messages = [
|
| 54 |
{
|