thejas-gida commited on
Commit
66e1c81
0 Parent(s):

Duplicate from thejas-gida/here-auto1

Browse files
Files changed (6) hide show
  1. .gitattributes +37 -0
  2. README.md +14 -0
  3. app.py +40 -0
  4. cars_bikes(1).json +3 -0
  5. cars_bikes(2).json +3 -0
  6. requirements.txt +3 -0
.gitattributes ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
6
+ *.ftz filter=lfs diff=lfs merge=lfs -text
7
+ *.gz filter=lfs diff=lfs merge=lfs -text
8
+ *.h5 filter=lfs diff=lfs merge=lfs -text
9
+ *.joblib filter=lfs diff=lfs merge=lfs -text
10
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
+ *.model filter=lfs diff=lfs merge=lfs -text
13
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
14
+ *.npy filter=lfs diff=lfs merge=lfs -text
15
+ *.npz filter=lfs diff=lfs merge=lfs -text
16
+ *.onnx filter=lfs diff=lfs merge=lfs -text
17
+ *.ot filter=lfs diff=lfs merge=lfs -text
18
+ *.parquet filter=lfs diff=lfs merge=lfs -text
19
+ *.pb filter=lfs diff=lfs merge=lfs -text
20
+ *.pickle filter=lfs diff=lfs merge=lfs -text
21
+ *.pkl filter=lfs diff=lfs merge=lfs -text
22
+ *.pt filter=lfs diff=lfs merge=lfs -text
23
+ *.pth filter=lfs diff=lfs merge=lfs -text
24
+ *.rar filter=lfs diff=lfs merge=lfs -text
25
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
26
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
28
+ *.tar filter=lfs diff=lfs merge=lfs -text
29
+ *.tflite filter=lfs diff=lfs merge=lfs -text
30
+ *.tgz filter=lfs diff=lfs merge=lfs -text
31
+ *.wasm filter=lfs diff=lfs merge=lfs -text
32
+ *.xz filter=lfs diff=lfs merge=lfs -text
33
+ *.zip filter=lfs diff=lfs merge=lfs -text
34
+ *.zst filter=lfs diff=lfs merge=lfs -text
35
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ cars_bikes(1).json filter=lfs diff=lfs merge=lfs -text
37
+ cars_bikes(2).json filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ title: Here Auto1
3
+ emoji: 💻
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: gradio
7
+ sdk_version: 3.36.1
8
+ app_file: app.py
9
+ pinned: false
10
+ license: apache-2.0
11
+ duplicated_from: thejas-gida/here-auto1
12
+ ---
13
+
14
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ from llama_index import SimpleDirectoryReader, GPTListIndex, readers, GPTSimpleVectorIndex, LLMPredictor, PromptHelper, ServiceContext
3
+ from langchain.agents import Tool
4
+ from langchain.chains.conversation.memory import ConversationBufferWindowMemory
5
+ from langchain.chat_models import ChatOpenAI
6
+ from langchain.agents import initialize_agent
7
+ from langchain import OpenAI
8
+ from langchain.prompts import PromptTemplate
9
+ PREFIX = ''' You are an Automobile expert AI scientist having all the knowledge about all the existing cars and bikes and all the information around it.
10
+ '''
11
+ SUFFIX = '''
12
+
13
+ Begin!
14
+
15
+ Previous conversation history:
16
+ {chat_history}
17
+
18
+ Instructions: {input}
19
+ {agent_scratchpad}
20
+ '''
21
+
22
+ index = GPTSimpleVectorIndex.load_from_disk('./cars_bikes(2).json')
23
+ tools = [Tool(
24
+ name = "LlamaIndex",
25
+ func=lambda q: str(index.query(q)),
26
+ description="You are an Automobile expert equipped with all the information related to cars and bikes. If the question is not related to cars, bike models, then please let the user know that My expertise lies only in automobiles, I can answer questions around the same. The input to this tool should be relevant to cars and bikes in Indian currency",
27
+ return_direct=True
28
+ )]
29
+
30
+ conversational_memory = ConversationBufferWindowMemory( memory_key='chat_history', k=5, return_messages=True )
31
+ llm = OpenAI(temperature=0.3, model_name="text-davinci-003")
32
+
33
+ agent_executor = initialize_agent(tools, llm, agent="conversational-react-description", memory=conversational_memory,agent_kwargs={'prefix':PREFIX,'suffix': SUFFIX})
34
+
35
+ def greet(Question):
36
+ return agent_executor.run(input=Question)
37
+
38
+ demo = gr.Interface(fn=greet, inputs=gr.Textbox(lines=2, label ="Question", placeholder="Enter the query"), outputs="text",title="Here Auto",description="Know everything about Cars and Bikes")
39
+
40
+ demo.launch()
cars_bikes(1).json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b5177a2ec88ef54a7ff7a5c366c2a27ac6437be43fc6d01838c6eae46f04c3f
3
+ size 124299833
cars_bikes(2).json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4e3af2e8abb171f7da28bd2f57bb424b7743bbcd0945ea8c856e91cb66f11410
3
+ size 183662823
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ llama-index==0.5.6
2
+ langchain==0.0.148
3
+ openai