Update app.py
Browse files
app.py
CHANGED
|
@@ -78,11 +78,6 @@ def qa_system(pdf_file, openai_key, prompt, chain_type, k):
|
|
| 78 |
result = qa({"query": prompt})
|
| 79 |
return result['result'], [doc.page_content for doc in result["source_documents"]]
|
| 80 |
|
| 81 |
-
# New interface
|
| 82 |
-
iface = gr.Interface(fn=chatbot,
|
| 83 |
-
inputs=gr.inputs.Textbox(lines=7, label="Enter your text"),
|
| 84 |
-
outputs="text",
|
| 85 |
-
title="Tikehau-trained AI Chatbot")
|
| 86 |
|
| 87 |
#index = construct_index("docs")
|
| 88 |
index = construct_index(dir_path)
|
|
@@ -98,9 +93,18 @@ k = gr.inputs.Slider(minimum=1, maximum=5, default=1, label="Number of Relevant
|
|
| 98 |
output_text = gr.outputs.Textbox(label="Answer")
|
| 99 |
output_docs = gr.outputs.Textbox(label="Relevant Source Text")
|
| 100 |
|
| 101 |
-
gr.Interface(fn=chatbot,
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 78 |
result = qa({"query": prompt})
|
| 79 |
return result['result'], [doc.page_content for doc in result["source_documents"]]
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
|
| 82 |
#index = construct_index("docs")
|
| 83 |
index = construct_index(dir_path)
|
|
|
|
| 93 |
output_text = gr.outputs.Textbox(label="Answer")
|
| 94 |
output_docs = gr.outputs.Textbox(label="Relevant Source Text")
|
| 95 |
|
| 96 |
+
#gr.Interface(fn=chatbot,
|
| 97 |
+
# inputs=[openai_key, prompt, chain_type, k], outputs=[output_text, output_docs],
|
| 98 |
+
# title="Question Answering with PDF File and OpenAI",
|
| 99 |
+
# description="Tikehau URDs.").launch(debug = True, shared=True)
|
| 100 |
|
| 101 |
+
iface = gr.Interface(fn=chatbot,
|
| 102 |
+
inputs=gr.inputs.Textbox(lines=7, label="Enter your text"),
|
| 103 |
+
outputs="text",
|
| 104 |
+
title="Tikehau-trained AI Chatbot")
|
| 105 |
|
| 106 |
+
|
| 107 |
+
gr.Interface(fn=chatbot,
|
| 108 |
+
inputs= prompt, outputs="text",
|
| 109 |
+
title="Question Answering with PDF File and OpenAI",
|
| 110 |
+
description="Tikehau URDs.").launch(debug = True, shared=True)
|