Jawachan commited on
Commit
b507438
1 Parent(s): d404b3e

Adding code to extract the course reviews

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -12,6 +12,7 @@ from langchain_community.llms import HuggingFaceEndpoint
12
  import gradio as gr
13
 
14
  import os
 
15
  from dotenv import load_dotenv
16
  # from llama.api import HuggingFaceEndpoint
17
  load_dotenv()
@@ -53,6 +54,17 @@ def langchain_document_loader(TMP_DIR):
53
  documents.extend(doc_loader.load())
54
  return documents
55
 
 
 
 
 
 
 
 
 
 
 
 
56
 
57
  directory_path = 'course reviews'
58
  TMP_DIR = Path(directory_path)
 
12
  import gradio as gr
13
 
14
  import os
15
+ import zipfile
16
  from dotenv import load_dotenv
17
  # from llama.api import HuggingFaceEndpoint
18
  load_dotenv()
 
54
  documents.extend(doc_loader.load())
55
  return documents
56
 
57
+ zip_file_path = 'course reviews.zip'
58
+
59
+ # Get the directory of the zip file
60
+ current_dir = os.getcwd()
61
+
62
+ print(current_dir)
63
+
64
+ # Extract the zip file in the same directory
65
+ with zipfile.ZipFile(zip_file_path, 'r') as zip_ref:
66
+ zip_ref.extractall(current_dir)
67
+
68
 
69
  directory_path = 'course reviews'
70
  TMP_DIR = Path(directory_path)