fastx commited on
Commit
2e83dbc
·
1 Parent(s): 60525c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +44 -1
app.py CHANGED
@@ -22,6 +22,49 @@ def construct_index(directory_path):
22
  prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
23
 
24
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
  os.environ["OPENAI_API_KEY"] = "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"
27
  construct_index("data")
@@ -38,7 +81,7 @@ def ask_ai(question,openai_api_key):
38
  return response.response
39
 
40
 
41
- api_key = gr.inputs.Textbox(label="OpenAI API Key (Or left blank to use default")
42
  iface = gr.Interface(fn=ask_ai, inputs=["text", api_key], outputs="text", title="Chatbot")
43
 
44
 
 
22
  prompt_helper = PromptHelper(max_input_size, num_outputs, max_chunk_overlap, chunk_size_limit=chunk_size_limit)
23
 
24
 
25
+ '''
26
+
27
+ import tkinter as tk
28
+ from llama_index import GPTSimpleVectorIndex, LLMPredictor, PromptHelper
29
+ from langchain import OpenAI
30
+ from IPython.display import Markdown, display
31
+
32
+
33
+
34
+ # Define the GUI
35
+ class ChatBotGUI:
36
+ def __init__(self, master):
37
+ self.master = master
38
+ master.title("Chat Bot")
39
+
40
+ # Create a label and an entry for the question
41
+ self.label = tk.Label(master, text="Ask me anything:")
42
+ self.label.pack()
43
+
44
+ self.entry = tk.Entry(master)
45
+ self.entry.pack()
46
+
47
+ # Create a button to submit the question
48
+ self.button = tk.Button(master, text="Submit", command=self.submit_question)
49
+ self.button.pack()
50
+
51
+ # Create a text box to display the response
52
+ self.textbox = tk.Text(master)
53
+ self.textbox.pack()
54
+
55
+ def submit_question(self):
56
+ question = self.entry.get()
57
+ response = ask_ai(question)
58
+ self.textbox.insert(tk.END, "You: " + question + "\n")
59
+ self.textbox.insert(tk.END, "Bot: " + response + "\n\n")
60
+ self.entry.delete(0, tk.END)
61
+
62
+ # Create an instance of the GUI and start the main loop
63
+ root = tk.Tk()
64
+ chatbot_gui = ChatBotGUI(root)
65
+ root.mainloop()
66
+ '''
67
+
68
 
69
  os.environ["OPENAI_API_KEY"] = "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"
70
  construct_index("data")
 
81
  return response.response
82
 
83
 
84
+ api_key = gr.inputs.Textbox(label="Paste OPENAI API Key (Or left it blank to use default api)")
85
  iface = gr.Interface(fn=ask_ai, inputs=["text", api_key], outputs="text", title="Chatbot")
86
 
87