slaviklavryk commited on
Commit
e113309
·
1 Parent(s): 8892312

Upload folder using huggingface_hub

Browse files
Files changed (4) hide show
  1. README.md +2 -8
  2. app.py +20 -0
  3. index.json +0 -0
  4. requirements.txt +4 -0
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
- title: OperativeIQ Chatbot Demo
3
- emoji:
4
- colorFrom: pink
5
- colorTo: blue
6
  sdk: gradio
7
  sdk_version: 3.45.2
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: OperativeIQ_Chatbot_Demo
3
+ app_file: app.py
 
 
4
  sdk: gradio
5
  sdk_version: 3.45.2
 
 
6
  ---
 
 
app.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
8
+ #os.environ["OPENAI_API_KEY"] = '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'
9
+
10
+ def chatbot(input_text):
11
+ index = GPTSimpleVectorIndex.load_from_disk('index.json')
12
+ response = index.query(input_text)
13
+ return response.response
14
+
15
+ iface = gr.Interface(fn=chatbot,
16
+ inputs=gr.components.Textbox(lines=5, label="Enter your text", show_copy_button=True),
17
+ outputs=gr.components.Textbox(lines=5, label="Answer", show_copy_button=True),
18
+ examples=["How to perform asset audit?", "What is Cycle count?", "How to print RFID tags?"],
19
+ title="OperativeIQ RFID Training AI Chatbot")
20
+ iface.launch(share=True)
index.json ADDED
The diff for this file is too large to render. See raw diff
 
requirements.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ gpt_index==0.4.24
2
+ langchain==0.0.118
3
+ PyPDF2==3.0.1
4
+ pycryptodome==3.18.0