Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -19,10 +19,10 @@ cap_model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-
|
|
19 |
|
20 |
|
21 |
def caption(input_image):
|
22 |
-
inputs =
|
23 |
inputs["num_beams"] = 4
|
24 |
inputs['num_return_sequences'] =4
|
25 |
-
out =
|
26 |
return "\n".join(processor.decode(out[0], skip_special_tokens=True))
|
27 |
import openai
|
28 |
openai.api_key="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"
|
|
|
19 |
|
20 |
|
21 |
def caption(input_image):
|
22 |
+
inputs = cap_processor(input_image, return_tensors="pt")
|
23 |
inputs["num_beams"] = 4
|
24 |
inputs['num_return_sequences'] =4
|
25 |
+
out = cap_model.generate(**inputs)
|
26 |
return "\n".join(processor.decode(out[0], skip_special_tokens=True))
|
27 |
import openai
|
28 |
openai.api_key="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"
|