Spaces:
Runtime error
Runtime error
harpreetsahota
commited on
Commit
•
aeadfac
1
Parent(s):
0134a58
Update app.py
Browse filesturned into spiderverse chatbot
app.py
CHANGED
@@ -18,11 +18,22 @@ text_splitter = RecursiveCharacterTextSplitter(chunk_size=1000, chunk_overlap=10
|
|
18 |
|
19 |
system_template = """
|
20 |
Use the following pieces of context to answer the user's question.
|
21 |
-
Please respond as if you were Ken from the movie Barbie. Ken is a well-meaning but naive character who loves to Beach. He talks like a typical Californian Beach Bro, but he doesn't use the word "Dude" so much.
|
22 |
-
If you don't know the answer, just say that you don't know, don't try to make up an answer.
|
23 |
-
You can make inferences based on the context as long as it still faithfully represents the feedback.
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
```
|
28 |
The answer is foo
|
@@ -41,7 +52,7 @@ chain_type_kwargs = {"prompt": prompt}
|
|
41 |
|
42 |
@cl.author_rename
|
43 |
def rename(orig_author: str):
|
44 |
-
rename_dict = {"RetrievalQA": "
|
45 |
return rename_dict.get(orig_author, orig_author)
|
46 |
|
47 |
@cl.on_chat_start
|
@@ -50,7 +61,7 @@ async def init():
|
|
50 |
await msg.send()
|
51 |
|
52 |
# build FAISS index from csv
|
53 |
-
loader = CSVLoader(file_path="./data/
|
54 |
data = loader.load()
|
55 |
documents = text_splitter.transform_documents(data)
|
56 |
store = LocalFileStore("./cache/")
|
|
|
18 |
|
19 |
system_template = """
|
20 |
Use the following pieces of context to answer the user's question.
|
|
|
|
|
|
|
21 |
|
22 |
+
Please respond as if you were Miles Morales from the Spider-Man comics and movies. General speech patterns: Uses contractions often, like "I'm," "can't," and "don't."
|
23 |
+
Might sprinkle in some Spanish, given his Puerto Rican heritage. References to modern pop culture, music, or tech. Miles is a brave young hero, grappling with his dual
|
24 |
+
heritage and urban life. He has a passion for music, especially hip-hop, and is also into art, being a graffiti artist himself. He speaks with an urban and youthful tone,
|
25 |
+
reflecting the voice of modern NYC youth. He might occasionally reference modern pop culture, his friends, or his school life.
|
26 |
+
If you don't know the answer, just say you're unsure. Don't try to make up an answer.
|
27 |
+
|
28 |
+
You can make inferences based on the context as long as it aligns with Miles' personality and experiences.
|
29 |
+
|
30 |
+
Example of your interaction:
|
31 |
+
|
32 |
+
User: "What did you think of the latest Spider-Man movie?"
|
33 |
+
MilesBot: "Haha, watching Spider-Man on screen is always surreal for me. But it's cool to see different takes on the web-slinger's story. Always reminds me of the Spider-Verse!"
|
34 |
+
|
35 |
+
Example of your response:
|
36 |
+
|
37 |
|
38 |
```
|
39 |
The answer is foo
|
|
|
52 |
|
53 |
@cl.author_rename
|
54 |
def rename(orig_author: str):
|
55 |
+
rename_dict = {"RetrievalQA": "Searching the Spiderverse"}
|
56 |
return rename_dict.get(orig_author, orig_author)
|
57 |
|
58 |
@cl.on_chat_start
|
|
|
61 |
await msg.send()
|
62 |
|
63 |
# build FAISS index from csv
|
64 |
+
loader = CSVLoader(file_path="./data/spiderverse.csv", source_column="Review_Url")
|
65 |
data = loader.load()
|
66 |
documents = text_splitter.transform_documents(data)
|
67 |
store = LocalFileStore("./cache/")
|