Spaces:
Sleeping
Sleeping
Pratik Dwivedi
commited on
Commit
·
9bf72c1
1
Parent(s):
ed6fc74
functionality test
Browse files
app.py
CHANGED
@@ -32,16 +32,27 @@ def load_pdf_content(pdf):
|
|
32 |
|
33 |
|
34 |
def main():
|
35 |
-
st.title("
|
36 |
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
45 |
|
46 |
if __name__ == "__main__":
|
47 |
main()
|
|
|
32 |
|
33 |
|
34 |
def main():
|
35 |
+
st.title("BetterZila RAG Enabled LLM")
|
36 |
|
37 |
+
with st.spinner("Loading model..."):
|
38 |
+
prompter = register_gguf_model()
|
39 |
+
st.success("Model loaded!")
|
40 |
+
|
41 |
+
with st.spinner("Loading PDF content from the assignment URL..."):
|
42 |
+
url = "https://pgcag.files.wordpress.com/2010/01/48lawsofpower.pdf"
|
43 |
+
pdf = load_pdf_from_url(url)
|
44 |
+
content = load_pdf_content(pdf)
|
45 |
+
st.success("PDF content loaded!")
|
46 |
+
|
47 |
+
queries = ['Can you give me an example from history where the enemy was crushed totally from the book?', "What's the point of making myself less accessible?", "Can you tell me the story of Queen Elizabeth I from this 48 laws of power book?"]
|
48 |
+
|
49 |
+
for query in queries:
|
50 |
+
st.subheader(f"Query: {query}")
|
51 |
+
with st.spinner("Generating response..."):
|
52 |
+
resp = prompter.prompt_main(query, context=content)
|
53 |
+
response = resp['llm_response']
|
54 |
+
st.success("Response generated!")
|
55 |
+
st.write(response)
|
56 |
|
57 |
if __name__ == "__main__":
|
58 |
main()
|