stephenmccartney1234 commited on
Commit
f8f96bf
·
verified ·
1 Parent(s): e274ec7

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -8
app.py CHANGED
@@ -4,8 +4,7 @@ import gradio as gr
4
  import sys
5
  import os
6
 
7
-
8
- os.environ["OPENAI_API_KEY"] = os.getenv("OPENAI_API_KEY")
9
 
10
  def construct_index(directory_path):
11
  max_input_size = 4096
@@ -25,20 +24,15 @@ def construct_index(directory_path):
25
 
26
  return index
27
 
28
-
29
  def chatbot(input_text):
30
- predetermined_text = "- please only answer using information found in the directory 'docs' and nothing else"
31
- input_text = input_text + predetermined_text
32
  index = GPTSimpleVectorIndex.load_from_disk('index.json')
33
  response = index.query(input_text, response_mode="compact")
34
  return response.response
35
 
36
-
37
-
38
  iface = gr.Interface(fn=chatbot,
39
  inputs=gr.components.Textbox(lines=7, label="What do you want to know about the project?"),
40
  outputs="text",
41
- title="Project Knowledge AI")
42
 
43
  index = construct_index("docs")
44
  iface.launch()
 
4
  import sys
5
  import os
6
 
7
+ os.environ["OPENAI_API_KEY"] = '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'
 
8
 
9
  def construct_index(directory_path):
10
  max_input_size = 4096
 
24
 
25
  return index
26
 
 
27
  def chatbot(input_text):
 
 
28
  index = GPTSimpleVectorIndex.load_from_disk('index.json')
29
  response = index.query(input_text, response_mode="compact")
30
  return response.response
31
 
 
 
32
  iface = gr.Interface(fn=chatbot,
33
  inputs=gr.components.Textbox(lines=7, label="What do you want to know about the project?"),
34
  outputs="text",
35
+ title="AI Project Guru Bot")
36
 
37
  index = construct_index("docs")
38
  iface.launch()