Szeyu commited on
Commit
37631cc
·
verified ·
1 Parent(s): 29e42d5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -5,6 +5,7 @@ import numpy as np
5
  import soundfile as sf
6
  import tempfile
7
  import os
 
8
 
9
  # Initialize pipelines
10
  @st.cache_resource
@@ -18,8 +19,11 @@ captioner, storyer, tts = load_pipelines()
18
 
19
  # Main logic
20
  def generate_content(image):
 
 
 
21
  # Generate caption
22
- caption = captioner(image)[0]["generated_text"]
23
  st.write("**Caption:**", caption)
24
 
25
  # Generate story
 
5
  import soundfile as sf
6
  import tempfile
7
  import os
8
+ from PIL import Image
9
 
10
  # Initialize pipelines
11
  @st.cache_resource
 
19
 
20
  # Main logic
21
  def generate_content(image):
22
+ # Convert Streamlit uploaded image to PIL image
23
+ pil_image = Image.open(image)
24
+
25
  # Generate caption
26
+ caption = captioner(pil_image)[0]["generated_text"]
27
  st.write("**Caption:**", caption)
28
 
29
  # Generate story