Sayiqa commited on
Commit
175ab81
·
verified ·
1 Parent(s): d6fb65a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -94
app.py CHANGED
@@ -1,66 +1,66 @@
1
- # import subprocess
2
- # subprocess.check_call(["pip", "install", "transformers==4.34.0"])
3
- # subprocess.check_call(["pip", "install", "torch>=1.7.1"])
4
- # subprocess.check_call(["pip", "install", "youtube_transcript_api>=0.6.3"])
5
- # subprocess.check_call(["pip", "install", "pytube"])
6
- # subprocess.check_call(["pip", "install", "huggingface_hub>=0.19.0"])
7
- # subprocess.check_call(["pip", "install", "PyPDF2>=3.0.1"])
8
- # subprocess.check_call(["pip", "install", "google-generativeai"])
9
- # subprocess.check_call(["pip", "install", "textblob>=0.17.1"])
10
- # subprocess.check_call(["pip", "install", "python-dotenv>=1.0.0"])
11
- # subprocess.check_call(["pip", "install", "genai"])
12
- # subprocess.check_call(["pip", "install", "google-cloud-aiplatform==1.34.0"])
13
- # import transformers
14
- # import torch
15
- # import os
16
- # import youtube_transcript_api
17
- # import pytube
18
- # import gradio
19
- # import PyPDF2
20
- # import pathlib
21
- # import pandas
22
- # import numpy
23
- # import textblob
24
- # import gradio as gr
25
- # from youtube_transcript_api import YouTubeTranscriptApi
26
- # import google.generativeai as genai
27
- # import requests
28
- # from textblob import TextBlob
29
- # import re
30
- # #from google.cloud import generativeai
31
- # from huggingface_hub import login
32
- # from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
33
- # def install_missing_packages():
34
- # required_packages = {
35
- # "torch":">=1.11.0",
36
- # "transformers":">=4.34.0",
37
- # "youtube_transcript_api" :">=0.6.3" ,
38
- # "pytube":None,
39
- # "huggingface_hub": ">=0.19.0",
40
- # "PyPDF2": ">=3.0.1",
41
- # "textblob":">=0.17.1",
42
- # "python-dotenv":">=1.0.0",
43
- # "genai":None,
44
- # "google-generativeai": None,
45
- # "google-cloud-aiplatform":"==1.34.0"
46
- # }
47
-
48
-
49
- # for package, version in required_packages.items():
50
- # try:
51
- # __import__(package)
52
- # except ImportError:
53
- # package_name = f"{package}{version}" if version else package
54
- # subprocess.check_call(["pip", "install", package_name])
55
 
56
- # install_missing_packages()
57
- # # Configuration
58
 
59
- # hf_token = os.getenv("HF_TOKEN")
60
- # if hf_token:
61
- # login(hf_token)
62
- # else:
63
- # raise ValueError("HF_TOKEN environment variable not set.")
 
 
 
 
 
 
 
 
 
 
64
 
65
 
66
  # # Configuration
@@ -440,39 +440,6 @@
440
  # if __name__ == "__main__":
441
  # app.launch()
442
 
443
- import subprocess
444
- import os
445
- import re
446
- from collections import Counter
447
- from textblob import TextBlob
448
- from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
449
- from googleapiclient.discovery import build
450
- import gradio as gr
451
-
452
- # Install required packages
453
- def install_missing_packages():
454
- required_packages = {
455
- "torch": ">=1.11.0",
456
- "transformers": ">=4.34.0",
457
- "youtube_transcript_api": ">=0.6.3",
458
- "pytube": None,
459
- "huggingface_hub": ">=0.19.0",
460
- "PyPDF2": ">=3.0.1",
461
- "textblob": ">=0.17.1",
462
- "python-dotenv": ">=1.0.0",
463
- "genai": None,
464
- "google-generativeai": None,
465
- "google-cloud-aiplatform": "==1.34.0"
466
- }
467
-
468
- for package, version in required_packages.items():
469
- try:
470
- __import__(package)
471
- except ImportError:
472
- package_name = f"{package}{version}" if version else package
473
- subprocess.check_call(["pip", "install", package_name])
474
-
475
- install_missing_packages()
476
 
477
  # Configuration
478
  GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
 
1
+ import subprocess
2
+ subprocess.check_call(["pip", "install", "transformers==4.34.0"])
3
+ subprocess.check_call(["pip", "install", "torch>=1.7.1"])
4
+ subprocess.check_call(["pip", "install", "youtube_transcript_api>=0.6.3"])
5
+ subprocess.check_call(["pip", "install", "pytube"])
6
+ subprocess.check_call(["pip", "install", "huggingface_hub>=0.19.0"])
7
+ subprocess.check_call(["pip", "install", "PyPDF2>=3.0.1"])
8
+ subprocess.check_call(["pip", "install", "google-generativeai"])
9
+ subprocess.check_call(["pip", "install", "textblob>=0.17.1"])
10
+ subprocess.check_call(["pip", "install", "python-dotenv>=1.0.0"])
11
+ subprocess.check_call(["pip", "install", "genai"])
12
+ subprocess.check_call(["pip", "install", "google-cloud-aiplatform==1.34.0"])
13
+ import transformers
14
+ import torch
15
+ import os
16
+ import youtube_transcript_api
17
+ import pytube
18
+ import gradio
19
+ import PyPDF2
20
+ import pathlib
21
+ import pandas
22
+ import numpy
23
+ import textblob
24
+ import gradio as gr
25
+ from youtube_transcript_api import YouTubeTranscriptApi
26
+ import google.generativeai as genai
27
+ import requests
28
+ from textblob import TextBlob
29
+ import re
30
+ #from google.cloud import generativeai
31
+ from huggingface_hub import login
32
+ from youtube_transcript_api import YouTubeTranscriptApi, TranscriptsDisabled, NoTranscriptFound
33
+ def install_missing_packages():
34
+ required_packages = {
35
+ "torch":">=1.11.0",
36
+ "transformers":">=4.34.0",
37
+ "youtube_transcript_api" :">=0.6.3" ,
38
+ "pytube":None,
39
+ "huggingface_hub": ">=0.19.0",
40
+ "PyPDF2": ">=3.0.1",
41
+ "textblob":">=0.17.1",
42
+ "python-dotenv":">=1.0.0",
43
+ "genai":None,
44
+ "google-generativeai": None,
45
+ "google-cloud-aiplatform":"==1.34.0"
46
+ }
 
 
 
 
 
 
 
 
47
 
 
 
48
 
49
+ for package, version in required_packages.items():
50
+ try:
51
+ __import__(package)
52
+ except ImportError:
53
+ package_name = f"{package}{version}" if version else package
54
+ subprocess.check_call(["pip", "install", package_name])
55
+
56
+ install_missing_packages()
57
+ # Configuration
58
+
59
+ hf_token = os.getenv("HF_TOKEN")
60
+ if hf_token:
61
+ login(hf_token)
62
+ else:
63
+ raise ValueError("HF_TOKEN environment variable not set.")
64
 
65
 
66
  # # Configuration
 
440
  # if __name__ == "__main__":
441
  # app.launch()
442
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
443
 
444
  # Configuration
445
  GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")