JoFrost commited on
Commit
9e5cc64
1 Parent(s): 250b791

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -14,7 +14,8 @@ title = "Confidential forensics tool with ChatGPT"
14
  examples = ["Who is Phillip Allen?", "What the project in Austin is about?", "Give me more details about the real estate project"]
15
 
16
  index = GPTSimpleVectorIndex.load_from_disk('email.json')
17
- df = pd.read_parquet("email_200.parquet")
 
18
  df2 = df["subject"].replace([None], "<no title>").head(10).to_frame()
19
 
20
  def search_emails(opt, message, n=3):
@@ -25,8 +26,6 @@ def search_emails(opt, message, n=3):
25
  try:
26
  embedding = get_embedding(message)
27
  message = ""
28
- df['embedding'] = df['embedding'].str.decode('utf-8').astype(float)
29
-
30
  df['similarities'] = df.embedding.apply(func=(lambda x: cosine_similarity(x, embedding)))
31
 
32
  message_tmp = df.sort_values('similarities', ascending=False).head(n)
@@ -131,4 +130,5 @@ with gr.Blocks(title=title) as demo:
131
  btn_send2.click(search_emails, [opt, msg2], [opt, msg2])
132
 
133
  if __name__ == "__main__":
134
- demo.launch(auth=("mithril", passwd))
 
 
14
  examples = ["Who is Phillip Allen?", "What the project in Austin is about?", "Give me more details about the real estate project"]
15
 
16
  index = GPTSimpleVectorIndex.load_from_disk('email.json')
17
+
18
+ df = pd.read_feather("emails.feather")
19
  df2 = df["subject"].replace([None], "<no title>").head(10).to_frame()
20
 
21
  def search_emails(opt, message, n=3):
 
26
  try:
27
  embedding = get_embedding(message)
28
  message = ""
 
 
29
  df['similarities'] = df.embedding.apply(func=(lambda x: cosine_similarity(x, embedding)))
30
 
31
  message_tmp = df.sort_values('similarities', ascending=False).head(n)
 
130
  btn_send2.click(search_emails, [opt, msg2], [opt, msg2])
131
 
132
  if __name__ == "__main__":
133
+ # demo.launch(auth=("mithril", passwd))
134
+ demo.launch()