from transformers import pipeline # Step 1: Load the pre-trained model image_to_text_pipeline = pipeline("image-to-text", model="Salesforce/blip-image-captioning-large") # Step 2: Get the uploaded image file path uploaded_files = get_uploaded_files() if not uploaded_files: print("Please upload an image file.") else: image_path = uploaded_files[0] # Assuming only one image is uploaded # Step 3: Test the model by providing the uploaded image generated_text = image_to_text_pipeline(image_path) # Step 4: Print the generated text print("Generated Text:", generated_text)