HUANG-Stephanie commited on
Commit
164d272
1 Parent(s): 57efe4c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -35
app.py CHANGED
@@ -17,7 +17,6 @@ from transformers import AutoProcessor
17
  from reportlab.pdfgen import canvas
18
  from reportlab.lib.pagesizes import letter
19
  from io import BytesIO
20
- from pymongo import MongoClient
21
 
22
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), './colpali-main')))
23
 
@@ -167,39 +166,5 @@ async def recommendation(file: UploadFile = File(...), k: int = 10):
167
 
168
  return response
169
 
170
- def get_database():
171
-
172
- # Provide the mongodb atlas url to connect python to mongodb using pymongo
173
- # CONNECTION_STRING = "mongodb://localhost:27017"
174
-
175
- # Create a connection using MongoClient. You can import MongoClient or use pymongo.MongoClient
176
- client = MongoClient('localhost', 27017)
177
-
178
-
179
- # Create the database for our example (we will use the same database throughout the tutorial
180
- return client['cvquest-colpali']
181
-
182
- dbname = get_database()
183
- collection_name = dbname["files"]
184
-
185
- item_1 = {
186
- "_id" : "U1IT00001",
187
- "item_name" : "Blender",
188
- "max_discount" : "10%",
189
- "batch_number" : "RR450020FRG",
190
- "price" : 340,
191
- "category" : "kitchen appliance"
192
- }
193
-
194
- item_2 = {
195
- "_id" : "U1IT00002",
196
- "item_name" : "Egg",
197
- "category" : "food",
198
- "quantity" : 12,
199
- "price" : 36,
200
- "item_description" : "brown country eggs"
201
- }
202
- collection_name.insert_many([item_1,item_2])
203
-
204
  if __name__ == "__main__":
205
  uvicorn.run(app, host="0.0.0.0", port=7860)
 
17
  from reportlab.pdfgen import canvas
18
  from reportlab.lib.pagesizes import letter
19
  from io import BytesIO
 
20
 
21
  sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), './colpali-main')))
22
 
 
166
 
167
  return response
168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
169
  if __name__ == "__main__":
170
  uvicorn.run(app, host="0.0.0.0", port=7860)