svummidi commited on
Commit
478e016
1 Parent(s): 54a7c7f

Upload 2 files

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. app.py +35 -0
  3. index.json +3 -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 Document, SimpleDirectoryReader, GPTListIndex, GPTSimpleVectorIndex, LLMPredictor, PromptHelper
2
+ from langchain import OpenAI
3
+ import openai
4
+ import gradio as gr
5
+ import sys
6
+ import os
7
+
8
+ openai.api_key = "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"
9
+
10
+ ### This is the code for the chatbot interface ###
11
+ ### INSTRUCTIONS: ###
12
+ ### 1. Run this file in the terminal: python3 llamaTest.py ###
13
+ ### 2. Copy the link that appears in the terminal and paste it into your browser
14
+ # there will be 2 links - one local and one global, you can use either ###
15
+
16
+
17
+
18
+ def chatbot(input_text):
19
+ """
20
+ Chatbot function that takes in a prompt and returns a response
21
+ """
22
+ index = GPTSimpleVectorIndex.load_from_disk('index.json')
23
+ response = index.query(input_text, response_mode="compact")
24
+ return response.response
25
+
26
+
27
+ iface = gr.Interface(fn=chatbot,
28
+ inputs=gr.inputs.Textbox(lines=7, label="Insert prompt"),
29
+ outputs="text",
30
+ title="Custom-index GPT-3 model")
31
+
32
+
33
+
34
+ index = GPTSimpleVectorIndex.load_from_disk('index.json')
35
+ iface.launch(share=True)
index.json ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6a42bea68b927b7820a4abd373d3e51ee78e18176e434505626b84628252b3b6
3
+ size 25269467