Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from transformers import pipeline
|
2 |
+
|
3 |
+
# Step 1: Load the pre-trained model
|
4 |
+
image_to_text_pipeline = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large")
|
5 |
+
|
6 |
+
# Step 2: Test the model by providing an image
|
7 |
+
image_path = "image.jpg"
|
8 |
+
generated_text = image_to_text_pipeline(image_path)
|
9 |
+
|
10 |
+
# Step 3: Print the generated text
|
11 |
+
print("Generated Text:", generated_text)
|