Walid-Ahmed commited on
Commit
152b1e6
·
verified ·
1 Parent(s): 702bc4a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -30
app.py CHANGED
@@ -17,36 +17,8 @@ caption_image = pipeline("image-to-text", model="Salesforce/blip-image-captionin
17
  # Load the text-to-speech pipeline
18
  narrator = pipeline("text-to-speech", model="kakao-enterprise/vits-ljs", device=device)
19
 
20
-
21
- # URLs of the images
22
- image_urls = [
23
- "https://github.com/Walid-Ahmed/ML_Datasets/blob/master/image1.jpeg?raw=true",
24
- "https://github.com/Walid-Ahmed/ML_Datasets/blob/master/image2.jpeg?raw=true",
25
- "https://github.com/Walid-Ahmed/ML_Datasets/blob/master/image3.jpeg?raw=true"
26
- ]
27
-
28
- # Directory to save images
29
- save_dir = "example_images"
30
- os.makedirs(save_dir, exist_ok=True)
31
-
32
- # Function to download images
33
- def download_image(url, filename):
34
- response = requests.get(url)
35
- if response.status_code == 200:
36
- with open(filename, "wb") as f:
37
- f.write(response.content)
38
- return filename
39
- else:
40
- print(f"Failed to download: {url}")
41
- return None
42
-
43
- # Download images
44
- example_images = []
45
- for idx, url in enumerate(image_urls):
46
- img_path = os.path.join(save_dir, f"image{idx+1}.jpeg")
47
- if not os.path.exists(img_path): # Avoid redownloading if already exists
48
- download_image(url, img_path)
49
- example_images.append(img_path)
50
 
51
  def process_image(image):
52
  # Generate the caption
 
17
  # Load the text-to-speech pipeline
18
  narrator = pipeline("text-to-speech", model="kakao-enterprise/vits-ljs", device=device)
19
 
20
+ # List of local image paths
21
+ example_images = ["image1.jpeg", "image2.jpeg", "image3.jpeg"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  def process_image(image):
24
  # Generate the caption