mobowuhan commited on
Commit
8db5cb1
·
1 Parent(s): 3ef85c4

Upload folder using huggingface_hub

Browse files
.gitattributes CHANGED
@@ -32,3 +32,11 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
32
  *.zip filter=lfs diff=lfs merge=lfs -text
33
  *.zst filter=lfs diff=lfs merge=lfs -text
34
  *tfevents* filter=lfs diff=lfs merge=lfs -text
35
+ data/GoGalaGames_merged_file.pdf filter=lfs diff=lfs merge=lfs -text
36
+ data/exceloutput.pdf filter=lfs diff=lfs merge=lfs -text
37
+ data/gala_merged_file.pdf filter=lfs diff=lfs merge=lfs -text
38
+ data/googleoutput.pdf filter=lfs diff=lfs merge=lfs -text
39
+ data/merged_file(1).pdf filter=lfs diff=lfs merge=lfs -text
40
+ data/merged_file.pdf filter=lfs diff=lfs merge=lfs -text
41
+ storage/docstore.json filter=lfs diff=lfs merge=lfs -text
42
+ storage/vector_store.json filter=lfs diff=lfs merge=lfs -text
DevSecOpsKB.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from llama_index import SimpleDirectoryReader, LLMPredictor, PromptHelper, StorageContext, ServiceContext, GPTVectorStoreIndex, load_index_from_storage
2
+ from langchain.chat_models import ChatOpenAI
3
+ import gradio as gr
4
+ import sys
5
+ import os
6
+ os.environ["OPENAI_API_KEY"] = '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'
7
+
8
+ def create_service_context():
9
+ #constraint parameters
10
+ max_input_size = 4096
11
+ num_outputs = 512
12
+ max_chunk_overlap = 1
13
+ chunk_size_limit = 600
14
+ #allows the user to explicitly set certain constraint parameters
15
+ prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
16
+ #LLMPredictor is a wrapper class around LangChain's LLMChain that allows easy integration into LlamaIndex
17
+ llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0.5, model_name="gpt-3.5-turbo", max_tokens=num_outputs))
18
+ #constructs service_context
19
+ service_context = ServiceContext.from_defaults(llm_predictor=llm_predictor, prompt_helper=prompt_helper)
20
+ return service_context
21
+
22
+ def data_ingestion_indexing(directory_path):
23
+ #loads data from the specified directory path
24
+ documents = SimpleDirectoryReader(directory_path).load_data()
25
+
26
+ #when first building the index
27
+ index = GPTVectorStoreIndex.from_documents(
28
+ documents, service_context=create_service_context()
29
+ )
30
+ #persist index to disk, default "storage" folder
31
+ index.storage_context.persist()
32
+ return index
33
+
34
+ def data_querying(input_text):
35
+ #rebuild storage context
36
+ storage_context = StorageContext.from_defaults(persist_dir="./storage")
37
+ #loads index from storage
38
+ index = load_index_from_storage(storage_context, service_context=create_service_context())
39
+
40
+ #queries the index with the input text
41
+ response = index.as_query_engine().query(input_text)
42
+
43
+ return response.response
44
+
45
+ iface = gr.Interface(fn=data_querying,
46
+ inputs=gr.components.Textbox(lines=7, label="Enter your question"),
47
+ outputs="text",
48
+ title="Wenqi's Custom-trained DevSecOps Knowledge Base")
49
+ #passes in data directory
50
+ index = data_ingestion_indexing("data")
51
+ iface.launch(share=True)
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
  title: DevSecOpsKB
3
- emoji: 👁
4
- colorFrom: gray
5
- colorTo: green
6
  sdk: gradio
7
  sdk_version: 3.33.1
8
- app_file: app.py
9
- pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: DevSecOpsKB
3
+ app_file: DevSecOpsKB.py
 
 
4
  sdk: gradio
5
  sdk_version: 3.33.1
 
 
6
  ---
 
 
data/GoGalaGames_merged_file.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5ceba5e5737d9c99eafdd3b4092421768ee37d7013c04043362597ff4f4cec65
3
+ size 5869862
data/exceloutput.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7caa9f587b65b812760e6fa8b76c160c3ae50b84487208f88b1d592e6e50b91f
3
+ size 1949030
data/gala_merged_file.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:383c11bd7e7aac553770714e09c9170fd31a664918105c4ef3176dd17bb61fab
3
+ size 77667094
data/googleoutput.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:74a13caa5c8af957f3a7add03eb68346a8e0920d6336456e98ab818e85322c9a
3
+ size 73853471
data/merged_file(1).pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2a9c2f58d0fbe8e5931c8cec48cfe7c45ae022ae4aa6a3a298dbcfd62d6563d4
3
+ size 17930742
data/merged_file.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6796e88b9c962a8b266bf2aff0755c70cbb1fe1dce3876d1f0ba8ca383245767
3
+ size 2397296
devsecopskb.log ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ None of PyTorch, TensorFlow >= 2.0, or Flax have been found. Models won't be available and only tokenizers, configuration and file/data utilities can be used.
2
+ Token indices sequence length is longer than the specified maximum sequence length for this model (1027 > 1024). Running this sequence through the model will result in indexing errors
3
+ huggingface/tokenizers: The current process just got forked, after parallelism has already been used. Disabling parallelism to avoid deadlocks...
4
+ To disable this warning, you can either:
5
+ - Avoid using `tokenizers` before the fork if possible
6
+ - Explicitly set the environment variable TOKENIZERS_PARALLELISM=(true | false)
storage/docstore.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc1684f2606c82d14d22b0b3e0c9767f0e34e24cb58bd79e7230f8624158fcd8
3
+ size 12521629
storage/index_store.json ADDED
The diff for this file is too large to render. See raw diff
 
storage/vector_store.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:93b3b8614309c5499aef7a6fdeef134590270e0e73d65c0f3a8be2be9483c3b3
3
+ size 154239360