Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,6 +4,16 @@ from gtts import gTTS
|
|
| 4 |
import io
|
| 5 |
from PIL import Image
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Load the image captioning model
|
| 8 |
caption_model = pipeline("image-to-text", model="Salesforce/blip-image-captioning-base")
|
| 9 |
|
|
|
|
| 4 |
import io
|
| 5 |
from PIL import Image
|
| 6 |
|
| 7 |
+
# Install PyTorch
|
| 8 |
+
try:
|
| 9 |
+
import torch
|
| 10 |
+
except ImportError:
|
| 11 |
+
st.warning("PyTorch is not installed. Installing PyTorch...")
|
| 12 |
+
import subprocess
|
| 13 |
+
subprocess.run(["pip", "install", "torch"])
|
| 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="Salesforce/blip-image-captioning-base")
|
| 19 |
|