lcyyyy commited on
Commit
0619931
·
verified ·
1 Parent(s): 3eeeca9

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -0
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)