facehugger92 commited on
Commit
9186bf3
1 Parent(s): 44e3c09

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -34
app.py DELETED
@@ -1,34 +0,0 @@
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
- Code from Beebom article: "How to Train an AI Chatbot With Custom Knowledge Base Using ChatGPT API" by Arjun Sha
9
- https://beebom.com/how-train-ai-chatbot-custom-knowledge-base-chatgpt-api/
10
- """
11
-
12
- def construct_index():
13
- max_input_size = 4096
14
- num_outputs = 512
15
- max_chunk_overlap = 20
16
- chunk_size_limit = 600
17
- prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
18
- llm_predictor = LLMPredictor(llm=ChatOpenAI(temperature=0.7, model_name="gpt-3.5-turbo-0613", max_tokens=num_outputs))
19
- index = GPTSimpleVectorIndex.load_from_disk('index.json', llm_predictor=llm_predictor, prompt_helper=prompt_helper)
20
-
21
- return index
22
-
23
- def chatbot(input_text):
24
- index = GPTSimpleVectorIndex.load_from_disk('index.json')
25
- response = index.query(input_text)
26
- return response.response
27
-
28
- iface = gr.Interface(fn=chatbot,
29
- inputs=gr.components.Textbox(lines=7, label="Enter your text"),
30
- outputs="text",
31
- title="AI Chatbot for the Doing What Works Library")
32
-
33
- # index = construct_index()
34
- iface.launch(share=False)