Update app.py
Browse files
app.py
CHANGED
|
@@ -31,6 +31,9 @@ pinecone_environment='us-west1-gcp-free'
|
|
| 31 |
user_db = {os.environ['username1']: os.environ['password1'], os.environ['username2']: os.environ['password2'], os.environ['username3']: os.environ['password3']}
|
| 32 |
|
| 33 |
messages = [{"role": "system", "content": 'You are a helpful assistant.'}]
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
#load up spacy
|
| 36 |
|
|
@@ -89,6 +92,25 @@ def delete_pinecone(index_name):
|
|
| 89 |
return
|
| 90 |
|
| 91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 92 |
|
| 93 |
|
| 94 |
|
|
@@ -174,6 +196,14 @@ def show():
|
|
| 174 |
return chats
|
| 175 |
|
| 176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 177 |
with gr.Blocks() as chatHistory:
|
| 178 |
gr.Markdown("Click the Clear button below to remove all the chat history.")
|
| 179 |
clear_btn = gr.Button("Clear")
|
|
@@ -225,7 +255,7 @@ vector_server = gr.Interface(fn=process_file, inputs=["text", gr.inputs.File(fil
|
|
| 225 |
file = gr.Interface(fn=fileSearch, inputs=[textbox2, "text"], outputs=[contextbox1, contextbox2, contextbox3], description = "This tab shows the top three most related contexts in the repository.")
|
| 226 |
#demo = gr.TabbedInterface([role, text, file, vector_server, pinecone_tools, chatHistory], [ "roleChoice", "Talk2File", "FileSearch", "VectorServer", "PineconeTools", "ChatHistory"])
|
| 227 |
|
| 228 |
-
demo = gr.TabbedInterface([text, file,
|
| 229 |
|
| 230 |
if __name__ == "__main__":
|
| 231 |
demo.launch(enable_queue=False, auth=lambda u, p: user_db.get(u) == p,
|
|
|
|
| 31 |
user_db = {os.environ['username1']: os.environ['password1'], os.environ['username2']: os.environ['password2'], os.environ['username3']: os.environ['password3']}
|
| 32 |
|
| 33 |
messages = [{"role": "system", "content": 'You are a helpful assistant.'}]
|
| 34 |
+
errors = []
|
| 35 |
+
|
| 36 |
+
|
| 37 |
|
| 38 |
#load up spacy
|
| 39 |
|
|
|
|
| 92 |
return
|
| 93 |
|
| 94 |
|
| 95 |
+
# Record feed back
|
| 96 |
+
|
| 97 |
+
def not_in_error():
|
| 98 |
+
return
|
| 99 |
+
|
| 100 |
+
|
| 101 |
+
def not_found_error():
|
| 102 |
+
return stats
|
| 103 |
+
|
| 104 |
+
|
| 105 |
+
|
| 106 |
+
def llm_error ():
|
| 107 |
+
return
|
| 108 |
+
|
| 109 |
+
def list_erros():
|
| 110 |
+
return
|
| 111 |
+
|
| 112 |
+
|
| 113 |
+
|
| 114 |
|
| 115 |
|
| 116 |
|
|
|
|
| 196 |
return chats
|
| 197 |
|
| 198 |
|
| 199 |
+
# feed back record
|
| 200 |
+
with gr.Blocks() as FeedBack:
|
| 201 |
+
gr.Markdown("Record Feedback for the ROCm Usage Tutor, using the following three buttons to record three different errors:\n 1. ROCm-related questions not inside the ROCm repo.\n 2. The context is in the repo, but the vector server fails to find it.\n 3. The LLM model fails to understand the context.")
|
| 202 |
+
|
| 203 |
+
|
| 204 |
+
|
| 205 |
+
|
| 206 |
+
|
| 207 |
with gr.Blocks() as chatHistory:
|
| 208 |
gr.Markdown("Click the Clear button below to remove all the chat history.")
|
| 209 |
clear_btn = gr.Button("Clear")
|
|
|
|
| 255 |
file = gr.Interface(fn=fileSearch, inputs=[textbox2, "text"], outputs=[contextbox1, contextbox2, contextbox3], description = "This tab shows the top three most related contexts in the repository.")
|
| 256 |
#demo = gr.TabbedInterface([role, text, file, vector_server, pinecone_tools, chatHistory], [ "roleChoice", "Talk2File", "FileSearch", "VectorServer", "PineconeTools", "ChatHistory"])
|
| 257 |
|
| 258 |
+
demo = gr.TabbedInterface([text, file, FeedBack], [ "ROCm Usage Tutor", "Top 3 Context", "Feedback"])
|
| 259 |
|
| 260 |
if __name__ == "__main__":
|
| 261 |
demo.launch(enable_queue=False, auth=lambda u, p: user_db.get(u) == p,
|