Spaces:
Runtime error
Runtime error
Commit
·
2665d9f
1
Parent(s):
21adbe8
Update app.py
Browse filesupdated the default value of the check type and chunks
app.py
CHANGED
@@ -33,14 +33,14 @@ def qa_system(pdf_file, openai_key, prompt, chain_type, k):
|
|
33 |
|
34 |
# get the result
|
35 |
result = qa({"query": prompt})
|
36 |
-
return result['result'],
|
37 |
|
38 |
# define the Gradio interface
|
39 |
input_file = gr.inputs.File(label="PDF File")
|
40 |
openai_key = gr.inputs.Textbox(label="OpenAI API Key", type="password")
|
41 |
prompt = gr.inputs.Textbox(label="Question Prompt")
|
42 |
-
chain_type = gr.inputs.Radio(['stuff', 'map_reduce', "refine", "map_rerank"], label="Chain Type")
|
43 |
-
k = gr.inputs.Slider(minimum=1, maximum=5, default=
|
44 |
|
45 |
output_text = gr.outputs.Textbox(label="Answer")
|
46 |
output_docs = gr.outputs.Textbox(label="Relevant Source Text")
|
|
|
33 |
|
34 |
# get the result
|
35 |
result = qa({"query": prompt})
|
36 |
+
return result['result'], ''.join(doc.page_content for doc in result["source_documents"])
|
37 |
|
38 |
# define the Gradio interface
|
39 |
input_file = gr.inputs.File(label="PDF File")
|
40 |
openai_key = gr.inputs.Textbox(label="OpenAI API Key", type="password")
|
41 |
prompt = gr.inputs.Textbox(label="Question Prompt")
|
42 |
+
chain_type = gr.inputs.Radio(['stuff', 'map_reduce', "refine", "map_rerank"],default = 'map_reduce',label="Chain Type")
|
43 |
+
k = gr.inputs.Slider(minimum=1, maximum=5, default=2, label="Number of Relevant Chunks")
|
44 |
|
45 |
output_text = gr.outputs.Textbox(label="Answer")
|
46 |
output_docs = gr.outputs.Textbox(label="Relevant Source Text")
|