koey811 commited on
Commit
4d55f3a
·
verified ·
1 Parent(s): b92cea6

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="TheBloke/storytime-13B-GPTQ")
25
 
26
  def generate_caption(image):
 
14
  st.success("PyTorch has been successfully installed!")
15
  import torch
16
 
17
+ # Install Optimum library
18
+ try:
19
+ import optimum
20
+ except ImportError:
21
+ st.warning("Optimum library is not installed. Installing optimum...")
22
+ import subprocess
23
+ subprocess.run(["pip", "install", "optimum"])
24
+ st.success("Optimum library has been successfully installed!")
25
+ import optimum
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="TheBloke/storytime-13B-GPTQ")
31
 
32
  def generate_caption(image):