MusIre commited on
Commit
85009c4
·
verified ·
1 Parent(s): 9795880

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -55
app.py CHANGED
@@ -71,41 +71,6 @@ df = df.drop(['message', 'file'], axis = 1)
71
  import chromadb
72
  chroma_client = chromadb.Client()
73
 
74
- collection = chroma_client.create_collection(name="emails")
75
-
76
- df.loc[4, 'text']
77
-
78
- for i in df.index:
79
- collection.add(
80
-
81
- documents = df.loc[i, 'text'],
82
-
83
-
84
- metadatas = [{"sender": df.loc[i, 'sender'],
85
- "recipient1": df.loc[i, 'recipient1'],
86
- "recipient2": df.loc[i, 'recipient2'],
87
- "recipient3": df.loc[i, 'recipient3'],
88
- "subject": df.loc[i, 'Subject'],
89
- "folder": df.loc[i, 'folder'],
90
- "date": str(df.loc[i, 'date'])
91
- }],
92
-
93
-
94
- ids = str(i)
95
- )
96
-
97
- collection.get(
98
- ids=["140"]
99
- )
100
-
101
- results = collection.query(
102
- query_texts = ["this is a document"],
103
- n_results = 2,
104
- include = ['distances', 'metadatas', 'documents']
105
- )
106
- results
107
-
108
-
109
  from chromadb.utils import embedding_functions
110
 
111
 
@@ -148,25 +113,6 @@ results
148
  import gradio as gr
149
 
150
 
151
- def query_chromadb(question,numberOfResults):
152
- results = collection_minilm.query(
153
- n_results = numberOfResults,
154
- )
155
-
156
- return results['documents'][0]
157
-
158
- iface = gr.Interface(
159
- fn=query_chromadb,
160
- inputs=["text","number"],
161
- outputs="text",
162
- title="Email Dataset Interface",
163
- description="Insert the question or the key word to find the topic correlated in the dataset"
164
- )
165
-
166
- iface.launch(share=True)
167
-
168
-
169
-
170
  import ast
171
 
172
  def create_output(dictionary, number):
@@ -218,7 +164,6 @@ def query_chromadb_advanced(question,numberOfResults):
218
 
219
  result_advance = query_chromadb_advanced("bank", 4)
220
 
221
- print(result_advance)
222
 
223
  iface = gr.Interface(
224
  fn=query_chromadb_advanced,
 
71
  import chromadb
72
  chroma_client = chromadb.Client()
73
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  from chromadb.utils import embedding_functions
75
 
76
 
 
113
  import gradio as gr
114
 
115
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
116
  import ast
117
 
118
  def create_output(dictionary, number):
 
164
 
165
  result_advance = query_chromadb_advanced("bank", 4)
166
 
 
167
 
168
  iface = gr.Interface(
169
  fn=query_chromadb_advanced,