facehugger92 commited on
Commit
8b7cec2
1 Parent(s): 57ca3f9

Upload 3 files

Browse files
Files changed (4) hide show
  1. .gitattributes +1 -0
  2. app.py +35 -0
  3. index.json +3 -0
  4. requirements.txt +82 -0
.gitattributes CHANGED
@@ -32,3 +32,4 @@ 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
+ index.json filter=lfs diff=lfs merge=lfs -text
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from gpt_index import SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
2
+ from langchain.chat_models import ChatOpenAI
3
+ import gradio as gr
4
+ import sys
5
+ import os
6
+
7
+
8
+ def construct_index():
9
+ max_input_size = 4096
10
+ num_outputs = 512
11
+ max_chunk_overlap = 20
12
+ chunk_size_limit = 600
13
+
14
+ prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
15
+
16
+ llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0.7, model_name="gpt-3.5-turbo", max_tokens=num_outputs))
17
+
18
+ # documents = SimpleDirectoryReader(directory_path).load_data()
19
+
20
+ index = GPTSimpleVectorIndex.load_from_disk('index.json', llm_predictor=llm_predictor, prompt_helper=prompt_helper)
21
+
22
+ return index
23
+
24
+ def chatbot(input_text):
25
+ index = GPTSimpleVectorIndex.load_from_disk('index.json')
26
+ response = index.query(input_text)
27
+ return response.response
28
+
29
+ iface = gr.Interface(fn=chatbot,
30
+ inputs=gr.components.Textbox(lines=7, label="Enter your text"),
31
+ outputs="text",
32
+ title="AI Chatbot for DWW Audio resources")
33
+
34
+ # index = construct_index()
35
+ iface.launch(share=False)
index.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b61fd2d6d1eb3ec3bb365b10db0829772868d33908fbae6334331012fb1db8db
3
+ size 22415132
requirements.txt ADDED
@@ -0,0 +1,82 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ aiofiles==23.1.0
2
+ aiohttp==3.8.4
3
+ aiosignal==1.3.1
4
+ altair==5.0.0
5
+ anyio==3.6.2
6
+ async-timeout==4.0.2
7
+ attrs==23.1.0
8
+ certifi==2023.5.7
9
+ charset-normalizer==3.1.0
10
+ click==8.1.3
11
+ colorama==0.4.6
12
+ contourpy==1.0.7
13
+ cycler==0.11.0
14
+ dataclasses-json==0.5.7
15
+ fastapi==0.95.2
16
+ ffmpy==0.3.0
17
+ filelock==3.12.0
18
+ fonttools==4.39.4
19
+ frozenlist==1.3.3
20
+ fsspec==2023.5.0
21
+ gpt-index==0.4.24
22
+ gradio==3.31.0
23
+ gradio_client==0.2.5
24
+ greenlet==2.0.2
25
+ h11==0.14.0
26
+ httpcore==0.17.1
27
+ httpx==0.24.0
28
+ huggingface-hub==0.14.1
29
+ idna==3.4
30
+ Jinja2==3.1.2
31
+ jsonschema==4.17.3
32
+ kiwisolver==1.4.4
33
+ langchain==0.0.148
34
+ linkify-it-py==2.0.2
35
+ llama-index==0.5.6
36
+ markdown-it-py==2.2.0
37
+ MarkupSafe==2.1.2
38
+ marshmallow==3.19.0
39
+ marshmallow-enum==1.5.1
40
+ matplotlib==3.7.1
41
+ mdit-py-plugins==0.3.3
42
+ mdurl==0.1.2
43
+ multidict==6.0.4
44
+ mypy-extensions==1.0.0
45
+ numexpr==2.8.4
46
+ numpy==1.24.3
47
+ openai==0.27.6
48
+ openapi-schema-pydantic==1.2.4
49
+ orjson==3.8.12
50
+ packaging==23.1
51
+ pandas==2.0.1
52
+ Pillow==9.5.0
53
+ pycryptodome==3.17
54
+ pydantic==1.10.7
55
+ pydub==0.25.1
56
+ Pygments==2.15.1
57
+ pyparsing==3.0.9
58
+ PyPDF2==3.0.1
59
+ pyrsistent==0.19.3
60
+ python-dateutil==2.8.2
61
+ python-multipart==0.0.6
62
+ pytz==2023.3
63
+ PyYAML==6.0
64
+ regex==2023.5.5
65
+ requests==2.30.0
66
+ semantic-version==2.10.0
67
+ six==1.16.0
68
+ sniffio==1.3.0
69
+ SQLAlchemy==1.4.48
70
+ starlette==0.27.0
71
+ tenacity==8.2.2
72
+ tiktoken==0.4.0
73
+ toolz==0.12.0
74
+ tqdm==4.65.0
75
+ typing-inspect==0.8.0
76
+ typing_extensions==4.5.0
77
+ tzdata==2023.3
78
+ uc-micro-py==1.0.2
79
+ urllib3==2.0.2
80
+ uvicorn==0.22.0
81
+ websockets==11.0.3
82
+ yarl==1.9.2