wuchangsheng951
commited on
Commit
•
1aed819
1
Parent(s):
4a2b7dd
Add application file
Browse files
app.py
CHANGED
@@ -40,13 +40,13 @@ class REPOGPT:
|
|
40 |
|
41 |
|
42 |
|
43 |
-
def REPOGPT_Initialized(self,):
|
44 |
|
45 |
|
46 |
os.environ["OPENAI_API_KEY"] = self.api_key
|
47 |
if self.load_vectorstore == None:
|
48 |
|
49 |
-
loader = UnstructuredPDFLoader( self.create_repo_pdf(self.repo_link))
|
50 |
pages = loader.load_and_split()
|
51 |
self.index = VectorstoreIndexCreator(vectorstore_cls = FAISS).from_loaders([loader])
|
52 |
self.vectorstore = self.index.vectorstore
|
@@ -198,11 +198,19 @@ class REPOGPT:
|
|
198 |
|
199 |
|
200 |
|
201 |
-
def create_repo_pdf(self, repo_link, merged_pdf = "merged.pdf"):
|
202 |
self.merged_pdf_path = merged_pdf
|
203 |
self.download_repo_zip(repo_link)
|
204 |
folder_name = self.extract_zip('./main.zip', './')
|
205 |
ingnore_list = ['__pycache__',]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
206 |
pdf_files = []
|
207 |
for root, dirs, files in os.walk(folder_name):
|
208 |
for file in files:
|
@@ -290,14 +298,14 @@ with gr.Blocks() as demo:
|
|
290 |
gr.Examples(
|
291 |
examples=["Whats the name of this repo?",
|
292 |
"Whats this repo for?",
|
293 |
-
"How can I use this
|
294 |
"how can I use this Experiment trackers ? Step by step",
|
295 |
"how can I Performing gradient accumulation with Accelerate? Step by step?",
|
296 |
"Make it like water-color painting",
|
297 |
"What is the background color",
|
298 |
"Describe this image",
|
299 |
"please detect the depth of this image",
|
300 |
-
"
|
301 |
],
|
302 |
inputs=txt
|
303 |
)
|
|
|
40 |
|
41 |
|
42 |
|
43 |
+
def REPOGPT_Initialized(self,image_included = False):
|
44 |
|
45 |
|
46 |
os.environ["OPENAI_API_KEY"] = self.api_key
|
47 |
if self.load_vectorstore == None:
|
48 |
|
49 |
+
loader = UnstructuredPDFLoader( self.create_repo_pdf(self.repo_link,image_included = image_included))
|
50 |
pages = loader.load_and_split()
|
51 |
self.index = VectorstoreIndexCreator(vectorstore_cls = FAISS).from_loaders([loader])
|
52 |
self.vectorstore = self.index.vectorstore
|
|
|
198 |
|
199 |
|
200 |
|
201 |
+
def create_repo_pdf(self, repo_link, image_included = False, merged_pdf = "merged.pdf"):
|
202 |
self.merged_pdf_path = merged_pdf
|
203 |
self.download_repo_zip(repo_link)
|
204 |
folder_name = self.extract_zip('./main.zip', './')
|
205 |
ingnore_list = ['__pycache__',]
|
206 |
+
if not image_included:
|
207 |
+
ingnore_list.append('.jpg')
|
208 |
+
ingnore_list.append('.png')
|
209 |
+
ingnore_list.append('.jpeg')
|
210 |
+
ingnore_list.append('.gif')
|
211 |
+
ingnore_list.append('.bmp')
|
212 |
+
ingnore_list.append('.tiff')
|
213 |
+
|
214 |
pdf_files = []
|
215 |
for root, dirs, files in os.walk(folder_name):
|
216 |
for file in files:
|
|
|
298 |
gr.Examples(
|
299 |
examples=["Whats the name of this repo?",
|
300 |
"Whats this repo for?",
|
301 |
+
"How can I use this Example code ? Step by step",
|
302 |
"how can I use this Experiment trackers ? Step by step",
|
303 |
"how can I Performing gradient accumulation with Accelerate? Step by step?",
|
304 |
"Make it like water-color painting",
|
305 |
"What is the background color",
|
306 |
"Describe this image",
|
307 |
"please detect the depth of this image",
|
308 |
+
"Whats the learning rate of this model?",
|
309 |
],
|
310 |
inputs=txt
|
311 |
)
|