jozzy commited on
Commit
d5742b6
·
1 Parent(s): 2a3480a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -141,7 +141,7 @@ def talk2file(index_name, text):
141
 
142
 
143
 
144
- return [context, "Answer:\n" + answer]
145
 
146
 
147
 
@@ -155,7 +155,7 @@ def fileSearch(index_name, prompt):
155
  docsearch = Pinecone.from_existing_index(index_name, embeddings)
156
  docs = docsearch.similarity_search(prompt)
157
 
158
- return "Content in file: \n\n" + docs[0].page_content + "\n\n"
159
 
160
 
161
 
@@ -210,6 +210,10 @@ answerbox = gr.inputs.Textbox(label="Assistant answer")
210
  contextbox = gr.Markdown(label="Context found")
211
 
212
 
 
 
 
 
213
  role = gr.Interface(fn=roleChoice, inputs="text", outputs="text", description = "Choose your GPT roles, e.g. You are a helpful technology assistant.")
214
  text = gr.Interface(fn=talk2file, inputs=[textbox, "text"], outputs=[contextbox, answerbox])
215
 
@@ -217,10 +221,10 @@ vector_server = gr.Interface(fn=process_file, inputs=["text", gr.inputs.File(fil
217
 
218
  #audio = gr.Interface(fn=audioGPT, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
219
  #siri = gr.Interface(fn=siriGPT, inputs=gr.Audio(source="microphone", type="filepath"), outputs = "audio")
220
- file = gr.Interface(fn=fileSearch, inputs=["text", "text"], outputs="text", description = "Enter file name and prompt")
221
  #demo = gr.TabbedInterface([role, text, file, vector_server, pinecone_tools, chatHistory], [ "roleChoice", "Talk2File", "FileSearch", "VectorServer", "PineconeTools", "ChatHistory"])
222
 
223
- demo = gr.TabbedInterface([text, file, chatHistory], [ "Talk2File", "FileSearch", "ChatHistory"])
224
 
225
  if __name__ == "__main__":
226
  demo.launch(enable_queue=False, auth=lambda u, p: user_db.get(u) == p,
 
141
 
142
 
143
 
144
+ return [context, answer]
145
 
146
 
147
 
 
155
  docsearch = Pinecone.from_existing_index(index_name, embeddings)
156
  docs = docsearch.similarity_search(prompt)
157
 
158
+ return [docs[0].page_content, docs[1].page_content, docs[2].page_content]
159
 
160
 
161
 
 
210
  contextbox = gr.Markdown(label="Context found")
211
 
212
 
213
+ contextbox1 = gr.Markdown(label="Top1 context")
214
+ contextbox2 = gr.Markdown(label="Top2 context")
215
+ contextbox3 = gr.Markdown(label="Top3 context")
216
+
217
  role = gr.Interface(fn=roleChoice, inputs="text", outputs="text", description = "Choose your GPT roles, e.g. You are a helpful technology assistant.")
218
  text = gr.Interface(fn=talk2file, inputs=[textbox, "text"], outputs=[contextbox, answerbox])
219
 
 
221
 
222
  #audio = gr.Interface(fn=audioGPT, inputs=gr.Audio(source="microphone", type="filepath"), outputs="text")
223
  #siri = gr.Interface(fn=siriGPT, inputs=gr.Audio(source="microphone", type="filepath"), outputs = "audio")
224
+ file = gr.Interface(fn=fileSearch, inputs=[textbox, "text"], outputs=[contextbox1, contextbox2, contextbox3], description = "This tab shows the top three most related contexts in the repository.")
225
  #demo = gr.TabbedInterface([role, text, file, vector_server, pinecone_tools, chatHistory], [ "roleChoice", "Talk2File", "FileSearch", "VectorServer", "PineconeTools", "ChatHistory"])
226
 
227
+ demo = gr.TabbedInterface([text, file, chatHistory], [ "ROCm Usage Tutor", "Top 3 Context", "ChatHistory"])
228
 
229
  if __name__ == "__main__":
230
  demo.launch(enable_queue=False, auth=lambda u, p: user_db.get(u) == p,