Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -33,14 +33,15 @@ def main(doc,prompt):
|
|
| 33 |
result=submitYourDocument(doc)
|
| 34 |
embeddings = HuggingFaceEmbeddings()
|
| 35 |
db = FAISS.from_texts(result, embeddings)
|
| 36 |
-
llm=HuggingFaceHub(repo_id="google/flan-t5-xxl",model_kwargs={"temperature":
|
| 37 |
chain=load_qa_chain(llm,chain_type="stuff")
|
| 38 |
query =prompt
|
| 39 |
docs = db.similarity_search(query)
|
| 40 |
return chain.run(input_documents=docs, question=query)
|
| 41 |
|
| 42 |
interface=gr.Interface(fn=main,inputs=[gr.File(label="Upload file"),gr.components.Textbox(label="Type Question Related to Uploaded Document")],
|
| 43 |
-
outputs=gr.components.Textbox("Answer..")
|
|
|
|
| 44 |
interface.launch(debug=True)
|
| 45 |
|
| 46 |
|
|
|
|
| 33 |
result=submitYourDocument(doc)
|
| 34 |
embeddings = HuggingFaceEmbeddings()
|
| 35 |
db = FAISS.from_texts(result, embeddings)
|
| 36 |
+
llm=HuggingFaceHub(repo_id="google/flan-t5-xxl",model_kwargs={"temperature":1, "max_length":512})
|
| 37 |
chain=load_qa_chain(llm,chain_type="stuff")
|
| 38 |
query =prompt
|
| 39 |
docs = db.similarity_search(query)
|
| 40 |
return chain.run(input_documents=docs, question=query)
|
| 41 |
|
| 42 |
interface=gr.Interface(fn=main,inputs=[gr.File(label="Upload file"),gr.components.Textbox(label="Type Question Related to Uploaded Document")],
|
| 43 |
+
outputs=gr.components.Textbox(label="Answer.."),
|
| 44 |
+
examples=[["FYP_Proposal.pdf","what is the summary of attached document?"],["FYP_Proposal.pdf","who is Mukesh Ambani?"],["FYP_Proposal.pdf","what is the title of document?"]])
|
| 45 |
interface.launch(debug=True)
|
| 46 |
|
| 47 |
|