Spaces:
Sleeping
Sleeping
Madhuri123
commited on
Commit
•
3b88e0c
1
Parent(s):
c12c5de
Update app.py
Browse files
app.py
CHANGED
@@ -22,7 +22,7 @@ def load_model_and_processor(model_id):
|
|
22 |
def generate_text(model, processor, image_url, prompt):
|
23 |
"""Generate text using the model and processor."""
|
24 |
try:
|
25 |
-
image = Image.open(
|
26 |
inputs = processor(image, prompt, return_tensors="pt").to(model.device)
|
27 |
output = model.generate(**inputs, max_new_tokens=30)
|
28 |
return processor.decode(output[0])
|
|
|
22 |
def generate_text(model, processor, image_url, prompt):
|
23 |
"""Generate text using the model and processor."""
|
24 |
try:
|
25 |
+
image = Image.open(io.BytesIO(response.content))
|
26 |
inputs = processor(image, prompt, return_tensors="pt").to(model.device)
|
27 |
output = model.generate(**inputs, max_new_tokens=30)
|
28 |
return processor.decode(output[0])
|