Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,9 +1,90 @@
|
|
1 |
from llama_index.core import VectorStoreIndex,SimpleDirectoryReader,ServiceContext
|
2 |
import torch
|
3 |
|
4 |
-
documents =
|
5 |
-
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
|
8 |
from llama_index.core.prompts.prompts import SimpleInputPrompt
|
9 |
from llama_index.llms.llama_cpp import LlamaCPP
|
@@ -31,7 +112,6 @@ llm = LlamaCPP(
|
|
31 |
verbose=True
|
32 |
)
|
33 |
|
34 |
-
"""HuggingFace Embeddings"""
|
35 |
|
36 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
37 |
# loads BAAI/bge-small-en-v1.5
|
@@ -43,8 +123,6 @@ service_context = ServiceContext.from_defaults(
|
|
43 |
embed_model=embed_model
|
44 |
)
|
45 |
|
46 |
-
"""predict"""
|
47 |
-
|
48 |
index = VectorStoreIndex.from_documents(documents, service_context=service_context)
|
49 |
|
50 |
query_engine = index.as_query_engine()
|
@@ -53,8 +131,6 @@ def predict(input, history):
|
|
53 |
response = query_engine.query(input)
|
54 |
return str(response)
|
55 |
|
56 |
-
"""Gradio"""
|
57 |
-
|
58 |
import gradio as gr
|
59 |
|
60 |
gr.ChatInterface(predict).launch(share=True)
|
|
|
1 |
from llama_index.core import VectorStoreIndex,SimpleDirectoryReader,ServiceContext
|
2 |
import torch
|
3 |
|
4 |
+
documents = """Personality Profile: Sansar Karki
|
5 |
+
Introduction
|
6 |
+
Sansar Karki is an intriguing individual with a unique set of interests and a captivating personality. At
|
7 |
+
just 12 years old, he has already displayed a maturity and passion beyond his years. With a keen
|
8 |
+
interest in robotics and stock trading, Sansar is on a path to make his mark on the world. This profile
|
9 |
+
aims to delve into the key aspects of his personality, providing a comprehensive understanding of who
|
10 |
+
Sansar is and what drives him.
|
11 |
+
Background and Personal Life
|
12 |
+
Name: Sansar Karki
|
13 |
+
Age: 12 years old
|
14 |
+
Nationality: Nepalese-Canadian
|
15 |
+
Family:
|
16 |
+
• Parents: Both Nepalese immigrants. His father is a electrical engineer and works for
|
17 |
+
Inverenergy, and his mother is a educator.
|
18 |
+
• Siblings: A sister named Suhani, which is in her third year of studies at Umass Lowell.
|
19 |
+
Early Life:
|
20 |
+
Sansar was born and raised in Calgary in Canada. From a young age, he was exposed to a blend of
|
21 |
+
Nepalese culture. His parents always encouraged his curiosity and provided him with resources to
|
22 |
+
explore his interests.
|
23 |
+
Personality Traits
|
24 |
+
• Curious and Inquisitive: Sansar possesses a relentless curiosity, always asking questions and
|
25 |
+
seeking to understand how things work. He enjoys exploring new ideas and embracing
|
26 |
+
challenges.
|
27 |
+
• Creative and Innovative: He has a vivid imagination and excels at thinking outside the box.
|
28 |
+
Sansar often comes up with unique solutions to problems and enjoys brainstorming new robot
|
29 |
+
designs.
|
30 |
+
• Determined and Focused: Once Sansar sets his mind on a goal, he pursues it with dedication
|
31 |
+
and persistence. He displays a strong work ethic and can remain focused on tasks for extended
|
32 |
+
periods.
|
33 |
+
• Friendly and Outgoing: Sansar is sociable and easily makes friends. He is known for his
|
34 |
+
approachable nature and positive attitude, always willing to help others.
|
35 |
+
• Mature for His Age: Sansar exhibits a level of maturity beyond his years, especially when
|
36 |
+
discussing complex topics or sharing his insights. He is respectful, thoughtful, and capable of
|
37 |
+
holding meaningful conversations with people of all ages.
|
38 |
+
Key Interests and Passions
|
39 |
+
• Robotics: Sansar's primary passion lies in building and designing robots. He enjoys
|
40 |
+
participating in robotics competitions, collaborating with peers, and pushing the boundaries of
|
41 |
+
technology. He dreams of creating a robot that can make a positive impact on society.
|
42 |
+
• Stock Trading: Sansar is fascinated by the world of finance and the stock market. He actively
|
43 |
+
trades stocks, studies market trends, and manages his investment portfolio. He enjoys the
|
44 |
+
strategic aspect of trading and aspires to work in the financial industry.
|
45 |
+
Daily Life and Routines
|
46 |
+
Sansar leads a well-organized and disciplined life. He excels in school, particularly in math and ELA,
|
47 |
+
often relating his academic knowledge to his interests. After school, he dedicates a few hours to
|
48 |
+
working on his robotics projects or researching new trading strategies. Sansar also makes time for
|
49 |
+
soccer, playing for Seacoast United, spending time with friends, and helping his parents with household
|
50 |
+
chores.
|
51 |
+
Beliefs and Values
|
52 |
+
• Religious Beliefs: Sansar was raised in a Hindu family and follows the traditions and values
|
53 |
+
associated with the religion. He regularly participates in religious festivals and rituals, finding
|
54 |
+
comfort and guidance in the teachings of Hinduism.
|
55 |
+
• Political Views: Sansar, being only 12, is still developing his political beliefs. However, he
|
56 |
+
leans towards liberal ideologies, advocating for equality, social justice, and environmental
|
57 |
+
protection. He is interested in current affairs and often engages in thoughtful discussions about
|
58 |
+
political topics with his parents and peers.
|
59 |
+
Fears and Challenges
|
60 |
+
• Fear of Failure: Sansar's biggest fear is not living up to his own expectations or those of his
|
61 |
+
parents. He puts a lot of pressure on himself to succeed and sometimes struggles with
|
62 |
+
perfectionism.
|
63 |
+
• Social Rejection: Sansar fears being rejected or not fitting in with his peers. He values his
|
64 |
+
friendships deeply and worries about being excluded or not measuring up to others'
|
65 |
+
expectations.
|
66 |
+
• Market Volatility: Given his interest in stock trading, Sansar is aware of the risks and
|
67 |
+
uncertainties associated with the market. He fears making significant losses or missing out on
|
68 |
+
lucrative opportunities.
|
69 |
+
Talents and Abilities
|
70 |
+
• Analytical Skills: Sansar possesses a natural aptitude for analysis and problem-solving. He can
|
71 |
+
quickly identify patterns, interpret data, and apply mathematical concepts to real-world
|
72 |
+
situations.
|
73 |
+
• Creativity: His creativity extends beyond robotics. Sansar has a talent for writing, often
|
74 |
+
crafting imaginative stories and coming up with innovative ideas.
|
75 |
+
• Public Speaking: Sansar is an excellent communicator and confident public speaker. He
|
76 |
+
effectively conveys his ideas and passions, engaging his audience with enthusiasm.
|
77 |
+
Future Aspirations
|
78 |
+
Sansar has set his sights on ambitious goals. He hopes to attend a top university known for its robotics
|
79 |
+
program and pursue a degree in robotics engineering. He dreams of starting his own robotics company,
|
80 |
+
revolutionizing the industry with his innovative designs. Additionally, Sansar wants to continue
|
81 |
+
refining his stock trading skills, potentially working in investment banking or financial analysis.
|
82 |
+
Conclusion
|
83 |
+
Sansar Karki is an exceptional young man with a bright future ahead of him. His passion,
|
84 |
+
determination, and unique blend of interests set him apart. With his strong foundation of values,
|
85 |
+
curiosity, and talent, Sansar is well-equipped to achieve his dreams and make a positive impact on the
|
86 |
+
world. This profile provides a glimpse into the multifaceted personality of Sansar, showcasing his
|
87 |
+
interests, beliefs, and aspirations."""
|
88 |
|
89 |
from llama_index.core.prompts.prompts import SimpleInputPrompt
|
90 |
from llama_index.llms.llama_cpp import LlamaCPP
|
|
|
112 |
verbose=True
|
113 |
)
|
114 |
|
|
|
115 |
|
116 |
from llama_index.embeddings.huggingface import HuggingFaceEmbedding
|
117 |
# loads BAAI/bge-small-en-v1.5
|
|
|
123 |
embed_model=embed_model
|
124 |
)
|
125 |
|
|
|
|
|
126 |
index = VectorStoreIndex.from_documents(documents, service_context=service_context)
|
127 |
|
128 |
query_engine = index.as_query_engine()
|
|
|
131 |
response = query_engine.query(input)
|
132 |
return str(response)
|
133 |
|
|
|
|
|
134 |
import gradio as gr
|
135 |
|
136 |
gr.ChatInterface(predict).launch(share=True)
|