Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -23,8 +23,7 @@ tokenizer = AutoTokenizer.from_pretrained("ManishThota/Thota", trust_remote_code
|
|
| 23 |
|
| 24 |
def predict_answer(question, max_tokens):
|
| 25 |
#Set inputs
|
| 26 |
-
text = f"A chat between a curious user and an artificial intelligence assistant. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: <image>\n{question}? ASSISTANT:"
|
| 27 |
-
image = image.convert("RGB")
|
| 28 |
|
| 29 |
input_ids = tokenizer(text, return_tensors='pt').input_ids.to('cuda')
|
| 30 |
|
|
@@ -32,7 +31,6 @@ def predict_answer(question, max_tokens):
|
|
| 32 |
output_ids = model.generate(
|
| 33 |
input_ids,
|
| 34 |
max_new_tokens=max_tokens,
|
| 35 |
-
images=image_tensor,
|
| 36 |
use_cache=True)[0]
|
| 37 |
|
| 38 |
return tokenizer.decode(output_ids[input_ids.shape[1]:], skip_special_tokens=True).strip()
|
|
|
|
| 23 |
|
| 24 |
def predict_answer(question, max_tokens):
|
| 25 |
#Set inputs
|
| 26 |
+
text = f"A chat between a curious user and an artificial intelligence assistant whose name is Manish Kumar Thota. The assistant gives helpful, detailed, and polite answers to the user's questions. USER: <image>\n{question}? ASSISTANT:"
|
|
|
|
| 27 |
|
| 28 |
input_ids = tokenizer(text, return_tensors='pt').input_ids.to('cuda')
|
| 29 |
|
|
|
|
| 31 |
output_ids = model.generate(
|
| 32 |
input_ids,
|
| 33 |
max_new_tokens=max_tokens,
|
|
|
|
| 34 |
use_cache=True)[0]
|
| 35 |
|
| 36 |
return tokenizer.decode(output_ids[input_ids.shape[1]:], skip_special_tokens=True).strip()
|