Update app.py
Browse files
app.py
CHANGED
|
@@ -133,15 +133,15 @@ def talk2file(index_name, text):
|
|
| 133 |
|
| 134 |
#Title1 = '<h2 style="background-color: yellow;"><b>User Question: </b></h2>'
|
| 135 |
#User_Question = f'<div style="background-color: yellow; display: inline-block; word-wrap: break-word;">{prompt}</div>'
|
| 136 |
-
Title2 = '<h2
|
| 137 |
-
context =
|
| 138 |
#context = f'<span style="background-color: #ADD8E6; display: inline-block; word-wrap: break-word;">{context2html}</span>'
|
| 139 |
#Title3 = '<h2 style="background-color: #90EE90;"><b>Ansewr: </b></h2>'
|
| 140 |
answer = system_message["content"]
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
-
return [
|
| 145 |
|
| 146 |
|
| 147 |
|
|
@@ -207,8 +207,11 @@ with gr.Blocks() as pinecone_tools:
|
|
| 207 |
|
| 208 |
textbox = gr.inputs.Textbox(label="Vector Server Index Name: ", default="amd")
|
| 209 |
answerbox = gr.inputs.Textbox(label="Assistant answer")
|
|
|
|
|
|
|
|
|
|
| 210 |
role = gr.Interface(fn=roleChoice, inputs="text", outputs="text", description = "Choose your GPT roles, e.g. You are a helpful technology assistant.")
|
| 211 |
-
text = gr.Interface(fn=talk2file, inputs=[textbox, "text"], outputs=[
|
| 212 |
|
| 213 |
vector_server = gr.Interface(fn=process_file, inputs=["text", gr.inputs.File(file_count="directory")], outputs="text")
|
| 214 |
|
|
|
|
| 133 |
|
| 134 |
#Title1 = '<h2 style="background-color: yellow;"><b>User Question: </b></h2>'
|
| 135 |
#User_Question = f'<div style="background-color: yellow; display: inline-block; word-wrap: break-word;">{prompt}</div>'
|
| 136 |
+
Title2 = '<h2><b>Context Found: </b></h2>'
|
| 137 |
+
context = docs[0].page_content
|
| 138 |
#context = f'<span style="background-color: #ADD8E6; display: inline-block; word-wrap: break-word;">{context2html}</span>'
|
| 139 |
#Title3 = '<h2 style="background-color: #90EE90;"><b>Ansewr: </b></h2>'
|
| 140 |
answer = system_message["content"]
|
| 141 |
|
| 142 |
|
| 143 |
|
| 144 |
+
return [context, "Answer:\n" + answer]
|
| 145 |
|
| 146 |
|
| 147 |
|
|
|
|
| 207 |
|
| 208 |
textbox = gr.inputs.Textbox(label="Vector Server Index Name: ", default="amd")
|
| 209 |
answerbox = gr.inputs.Textbox(label="Assistant answer")
|
| 210 |
+
contextbox = gr.Markdown()
|
| 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 |
|
| 216 |
vector_server = gr.Interface(fn=process_file, inputs=["text", gr.inputs.File(file_count="directory")], outputs="text")
|
| 217 |
|