Spaces:
Running
Running
Commit
·
a19d519
1
Parent(s):
b519502
logging added and max new token size reduced
Browse files
app.py
CHANGED
|
@@ -26,13 +26,20 @@ def analyze_palm(image, question, history):
|
|
| 26 |
|
| 27 |
# Add <image> token explicitly in the text
|
| 28 |
prompt = f"<image>\n{question}"
|
|
|
|
|
|
|
| 29 |
# Manual prompt construction (works for TinyLLaVA)
|
| 30 |
inputs = processor(text=prompt, images=image, return_tensors="pt").to(model.device)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 31 |
|
| 32 |
-
outputs = model.generate(**inputs, max_new_tokens=512)
|
| 33 |
response = processor.decode(outputs[0], skip_special_tokens=True)
|
| 34 |
|
| 35 |
history.append((question, response))
|
|
|
|
|
|
|
| 36 |
return history, ""
|
| 37 |
|
| 38 |
|
|
|
|
| 26 |
|
| 27 |
# Add <image> token explicitly in the text
|
| 28 |
prompt = f"<image>\n{question}"
|
| 29 |
+
print("Processing image and prompt")
|
| 30 |
+
|
| 31 |
# Manual prompt construction (works for TinyLLaVA)
|
| 32 |
inputs = processor(text=prompt, images=image, return_tensors="pt").to(model.device)
|
| 33 |
+
print("Inputs encoded")
|
| 34 |
+
|
| 35 |
+
outputs = model.generate(**inputs, max_new_tokens=256)
|
| 36 |
+
print("Output generated")
|
| 37 |
|
|
|
|
| 38 |
response = processor.decode(outputs[0], skip_special_tokens=True)
|
| 39 |
|
| 40 |
history.append((question, response))
|
| 41 |
+
print("Returning response")
|
| 42 |
+
|
| 43 |
return history, ""
|
| 44 |
|
| 45 |
|