koey811 commited on
Commit
b7c7cad
·
verified ·
1 Parent(s): 0d85f9f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -14,13 +14,19 @@ except ImportError:
14
  st.success("PyTorch has been successfully installed!")
15
  import torch
16
 
 
 
 
 
 
 
 
 
 
 
17
  # Load the image captioning model
18
  caption_model = pipeline("image-to-text", model="unography/blip-large-long-cap")
19
 
20
- #story_generator = pipeline("text-generation", model="distilbert/distilgpt2")
21
-
22
- #story_generator = pipeline("text-generation", model="isarth/distill_gpt2_story_generator")
23
-
24
  story_generator = pipeline("text-generation", model="mosaicml/mpt-7b-storywriter", trust_remote_code=True)
25
 
26
  def generate_caption(image):
 
14
  st.success("PyTorch has been successfully installed!")
15
  import torch
16
 
17
+ # Install Einops library
18
+ try:
19
+ import einops
20
+ except ImportError:
21
+ st.warning("Einops library is not installed. Installing einops...")
22
+ import subprocess
23
+ subprocess.run(["pip", "install", "einops"])
24
+ st.success("Einops library has been successfully installed!")
25
+ import einops
26
+
27
  # Load the image captioning model
28
  caption_model = pipeline("image-to-text", model="unography/blip-large-long-cap")
29
 
 
 
 
 
30
  story_generator = pipeline("text-generation", model="mosaicml/mpt-7b-storywriter", trust_remote_code=True)
31
 
32
  def generate_caption(image):