Spaces:
Runtime error
Runtime error
Commit ·
3f484f6
1
Parent(s): 0d55045
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,14 +29,14 @@ model = BlipForConditionalGeneration.from_pretrained("Salesforce/blip-image-capt
|
|
| 29 |
#gr.Textbox(os.environ['HF_TOKENS'])
|
| 30 |
|
| 31 |
#Image-to-text endpoint
|
| 32 |
-
def get_completion(
|
| 33 |
-
raw_image = Image.open(image).convert('RGB')
|
| 34 |
|
| 35 |
text = "a photography of"
|
| 36 |
inputs = processor(raw_image, text, return_tensors="pt")
|
| 37 |
|
| 38 |
out = model.generate(**inputs)
|
| 39 |
-
return
|
| 40 |
|
| 41 |
|
| 42 |
# headers = {
|
|
|
|
| 29 |
#gr.Textbox(os.environ['HF_TOKENS'])
|
| 30 |
|
| 31 |
#Image-to-text endpoint
|
| 32 |
+
def get_completion(raw_image):
|
| 33 |
+
#raw_image = Image.open(image).convert('RGB')
|
| 34 |
|
| 35 |
text = "a photography of"
|
| 36 |
inputs = processor(raw_image, text, return_tensors="pt")
|
| 37 |
|
| 38 |
out = model.generate(**inputs)
|
| 39 |
+
return processor.decode(out[0], skip_special_tokens=True)
|
| 40 |
|
| 41 |
|
| 42 |
# headers = {
|