tejash300 commited on
Commit
cec4c81
Β·
verified Β·
1 Parent(s): ea30ac0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -1,12 +1,8 @@
1
  import subprocess
2
  import sys
3
 
4
- # βœ… Ensure moviepy is installed at runtime
5
- try:
6
- import moviepy.editor as mp
7
- except ImportError:
8
- subprocess.run([sys.executable, "-m", "pip", "install", "--no-cache-dir", "moviepy", "imageio[ffmpeg]"])
9
- import moviepy.editor as mp # Try importing again
10
 
11
  import os
12
  import io
@@ -14,12 +10,14 @@ import torch
14
  import uvicorn
15
  import spacy
16
  import pdfplumber
 
17
  import librosa
18
  import soundfile as sf
19
  from fastapi import FastAPI, UploadFile, File, HTTPException
20
  from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
21
  from sentence_transformers import SentenceTransformer, util
22
 
 
23
  # βœ… Suppress Warnings
24
  os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
25
  os.environ['CUDA_VISIBLE_DEVICES'] = '0'
 
1
  import subprocess
2
  import sys
3
 
4
+ # βœ… Force install moviepy before imports
5
+ subprocess.run([sys.executable, "-m", "pip", "install", "--no-cache-dir", "moviepy", "imageio[ffmpeg]"])
 
 
 
 
6
 
7
  import os
8
  import io
 
10
  import uvicorn
11
  import spacy
12
  import pdfplumber
13
+ import moviepy.editor as mp # Now it will be installed before this line
14
  import librosa
15
  import soundfile as sf
16
  from fastapi import FastAPI, UploadFile, File, HTTPException
17
  from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
18
  from sentence_transformers import SentenceTransformer, util
19
 
20
+
21
  # βœ… Suppress Warnings
22
  os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3'
23
  os.environ['CUDA_VISIBLE_DEVICES'] = '0'