HazlamiMalek commited on
Commit
3c4c972
·
verified ·
1 Parent(s): 7f4ed8a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -0
app.py CHANGED
@@ -3,7 +3,23 @@ from PIL import Image
3
  from transformers import LlavaNextProcessor, LlavaNextForConditionalGeneration
4
  from gtts import gTTS
5
  import torch
 
 
6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  # Debug: Start of the app
8
  st.title("Image-to-Audio Description Generator")
9
 
 
3
  from transformers import LlavaNextProcessor, LlavaNextForConditionalGeneration
4
  from gtts import gTTS
5
  import torch
6
+ import subprocess
7
+ import sys
8
 
9
+ # Install transformers if not already installed
10
+ try:
11
+ import transformers
12
+ except ImportError:
13
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "transformers"])
14
+ try:
15
+ import transformers
16
+ st.write("Transformers module is already installed!")
17
+ except ImportError:
18
+ st.write("Installing transformers...")
19
+ subprocess.check_call([sys.executable, "-m", "pip", "install", "transformers"])
20
+ st.write("Transformers installed successfully!")
21
+
22
+ st.write("Environment is working!")
23
  # Debug: Start of the app
24
  st.title("Image-to-Audio Description Generator")
25