File size: 26,112 Bytes
fe46ef0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "72e26e1c-3fda-4333-9401-4ee15d1bf3b8",
   "metadata": {},
   "outputs": [],
   "source": [
    "model_id = \"sentence-transformers/all-MiniLM-L6-v2\"\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "68f1d64b-12b2-4d2a-a06a-6a7d35c3a6f5",
   "metadata": {},
   "outputs": [],
   "source": [
    "import requests\n",
    "\n",
    "api_url = f\"https://api-inference.huggingface.co/pipeline/feature-extraction/{model_id}\"\n",
    "headers = {\"Authorization\": f\"Bearer {hf_token}\"}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "aae00acb-6932-4b46-bc99-a542740c0f33",
   "metadata": {},
   "outputs": [],
   "source": [
    "def query(texts):\n",
    "    response = requests.post(api_url, headers=headers, json={\"inputs\": texts, \"options\":{\"wait_for_model\":True}})\n",
    "    return response.json()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "id": "3955111a-6785-4375-b6cd-126f5bd9afd4",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n",
    "import pandas as pd\n",
    "\n",
    "# Pfad zur CSV-Datei\n",
    "file_path = '/Users/I569961/Downloads/imdb_top_1000.csv'\n",
    "\n",
    "# Einlesen der CSV-Datei\n",
    "data = pd.read_csv(file_path)\n",
    "\n",
    "# Konvertieren des DataFrame in einen String\n",
    "data_string = data.to_string()\n",
    "\n",
    "output = query(texts)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "id": "c5615ec3-2168-420c-9146-77c37b8df8fb",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "      <th>6</th>\n",
       "      <th>7</th>\n",
       "      <th>8</th>\n",
       "      <th>9</th>\n",
       "      <th>...</th>\n",
       "      <th>374</th>\n",
       "      <th>375</th>\n",
       "      <th>376</th>\n",
       "      <th>377</th>\n",
       "      <th>378</th>\n",
       "      <th>379</th>\n",
       "      <th>380</th>\n",
       "      <th>381</th>\n",
       "      <th>382</th>\n",
       "      <th>383</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.023889</td>\n",
       "      <td>0.055259</td>\n",
       "      <td>-0.011655</td>\n",
       "      <td>-0.033414</td>\n",
       "      <td>-0.012261</td>\n",
       "      <td>-0.024873</td>\n",
       "      <td>-0.012663</td>\n",
       "      <td>0.025346</td>\n",
       "      <td>0.018508</td>\n",
       "      <td>-0.083508</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.161688</td>\n",
       "      <td>-0.046426</td>\n",
       "      <td>0.006004</td>\n",
       "      <td>0.005281</td>\n",
       "      <td>-0.003342</td>\n",
       "      <td>0.027754</td>\n",
       "      <td>0.020411</td>\n",
       "      <td>0.005778</td>\n",
       "      <td>0.034098</td>\n",
       "      <td>-0.006889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.012688</td>\n",
       "      <td>0.046874</td>\n",
       "      <td>-0.010502</td>\n",
       "      <td>-0.020384</td>\n",
       "      <td>-0.013361</td>\n",
       "      <td>0.042322</td>\n",
       "      <td>0.016628</td>\n",
       "      <td>-0.004099</td>\n",
       "      <td>-0.002607</td>\n",
       "      <td>-0.010188</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.061594</td>\n",
       "      <td>-0.020717</td>\n",
       "      <td>-0.009082</td>\n",
       "      <td>-0.029260</td>\n",
       "      <td>-0.066253</td>\n",
       "      <td>0.065257</td>\n",
       "      <td>0.013229</td>\n",
       "      <td>-0.023103</td>\n",
       "      <td>-0.002785</td>\n",
       "      <td>0.010474</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>0.000494</td>\n",
       "      <td>0.119412</td>\n",
       "      <td>0.005229</td>\n",
       "      <td>-0.092734</td>\n",
       "      <td>0.007773</td>\n",
       "      <td>-0.005325</td>\n",
       "      <td>0.034506</td>\n",
       "      <td>-0.051981</td>\n",
       "      <td>-0.006265</td>\n",
       "      <td>-0.006111</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.108326</td>\n",
       "      <td>-0.049646</td>\n",
       "      <td>-0.073399</td>\n",
       "      <td>-0.029898</td>\n",
       "      <td>-0.102734</td>\n",
       "      <td>0.062121</td>\n",
       "      <td>0.034606</td>\n",
       "      <td>0.016877</td>\n",
       "      <td>-0.023861</td>\n",
       "      <td>0.005264</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-0.029711</td>\n",
       "      <td>0.023298</td>\n",
       "      <td>-0.057041</td>\n",
       "      <td>-0.012183</td>\n",
       "      <td>-0.013710</td>\n",
       "      <td>0.029796</td>\n",
       "      <td>0.063739</td>\n",
       "      <td>0.001101</td>\n",
       "      <td>-0.045124</td>\n",
       "      <td>-0.040748</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.117682</td>\n",
       "      <td>0.031924</td>\n",
       "      <td>0.000854</td>\n",
       "      <td>0.020200</td>\n",
       "      <td>-0.020666</td>\n",
       "      <td>-0.005167</td>\n",
       "      <td>0.038370</td>\n",
       "      <td>0.003617</td>\n",
       "      <td>0.033993</td>\n",
       "      <td>-0.010255</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.025628</td>\n",
       "      <td>0.070389</td>\n",
       "      <td>-0.017380</td>\n",
       "      <td>-0.056567</td>\n",
       "      <td>0.028577</td>\n",
       "      <td>0.052823</td>\n",
       "      <td>0.067063</td>\n",
       "      <td>-0.052618</td>\n",
       "      <td>-0.054702</td>\n",
       "      <td>-0.116230</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.118145</td>\n",
       "      <td>0.013343</td>\n",
       "      <td>-0.055188</td>\n",
       "      <td>-0.032723</td>\n",
       "      <td>0.008436</td>\n",
       "      <td>0.019169</td>\n",
       "      <td>0.048212</td>\n",
       "      <td>-0.040412</td>\n",
       "      <td>0.083346</td>\n",
       "      <td>0.026855</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>-0.022656</td>\n",
       "      <td>0.021160</td>\n",
       "      <td>0.005105</td>\n",
       "      <td>-0.046494</td>\n",
       "      <td>0.009074</td>\n",
       "      <td>0.041495</td>\n",
       "      <td>0.054268</td>\n",
       "      <td>-0.024185</td>\n",
       "      <td>-0.013483</td>\n",
       "      <td>-0.075966</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.100110</td>\n",
       "      <td>0.010750</td>\n",
       "      <td>-0.031469</td>\n",
       "      <td>-0.004822</td>\n",
       "      <td>0.039657</td>\n",
       "      <td>0.026384</td>\n",
       "      <td>0.045514</td>\n",
       "      <td>0.059089</td>\n",
       "      <td>-0.017509</td>\n",
       "      <td>0.007166</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-0.002911</td>\n",
       "      <td>0.060791</td>\n",
       "      <td>-0.009176</td>\n",
       "      <td>-0.006133</td>\n",
       "      <td>0.040492</td>\n",
       "      <td>0.036594</td>\n",
       "      <td>0.002054</td>\n",
       "      <td>-0.031345</td>\n",
       "      <td>0.031806</td>\n",
       "      <td>-0.023495</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.028763</td>\n",
       "      <td>-0.060458</td>\n",
       "      <td>-0.018598</td>\n",
       "      <td>-0.040189</td>\n",
       "      <td>-0.031486</td>\n",
       "      <td>-0.018299</td>\n",
       "      <td>0.002286</td>\n",
       "      <td>-0.073420</td>\n",
       "      <td>0.016235</td>\n",
       "      <td>-0.000244</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-0.080526</td>\n",
       "      <td>0.059888</td>\n",
       "      <td>-0.048847</td>\n",
       "      <td>-0.040176</td>\n",
       "      <td>-0.063342</td>\n",
       "      <td>0.041848</td>\n",
       "      <td>0.119045</td>\n",
       "      <td>0.010652</td>\n",
       "      <td>-0.030095</td>\n",
       "      <td>-0.004561</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.144566</td>\n",
       "      <td>0.020404</td>\n",
       "      <td>0.023088</td>\n",
       "      <td>0.005077</td>\n",
       "      <td>-0.055645</td>\n",
       "      <td>-0.007675</td>\n",
       "      <td>0.050791</td>\n",
       "      <td>-0.005989</td>\n",
       "      <td>0.134562</td>\n",
       "      <td>0.034817</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-0.034388</td>\n",
       "      <td>0.072501</td>\n",
       "      <td>0.014440</td>\n",
       "      <td>-0.036695</td>\n",
       "      <td>0.014019</td>\n",
       "      <td>0.063070</td>\n",
       "      <td>0.034683</td>\n",
       "      <td>-0.014531</td>\n",
       "      <td>-0.059862</td>\n",
       "      <td>-0.045383</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.114763</td>\n",
       "      <td>-0.035894</td>\n",
       "      <td>-0.019877</td>\n",
       "      <td>-0.033375</td>\n",
       "      <td>-0.030168</td>\n",
       "      <td>0.039412</td>\n",
       "      <td>0.044993</td>\n",
       "      <td>0.000578</td>\n",
       "      <td>-0.025124</td>\n",
       "      <td>0.034191</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>-0.005964</td>\n",
       "      <td>0.025044</td>\n",
       "      <td>-0.003182</td>\n",
       "      <td>-0.025243</td>\n",
       "      <td>-0.039823</td>\n",
       "      <td>-0.012772</td>\n",
       "      <td>0.044713</td>\n",
       "      <td>0.014535</td>\n",
       "      <td>-0.038213</td>\n",
       "      <td>-0.041149</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.057621</td>\n",
       "      <td>0.021594</td>\n",
       "      <td>0.048983</td>\n",
       "      <td>-0.044541</td>\n",
       "      <td>-0.030137</td>\n",
       "      <td>0.006779</td>\n",
       "      <td>0.054854</td>\n",
       "      <td>0.029937</td>\n",
       "      <td>0.070214</td>\n",
       "      <td>0.041565</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>-0.039008</td>\n",
       "      <td>-0.010609</td>\n",
       "      <td>-0.007383</td>\n",
       "      <td>-0.050190</td>\n",
       "      <td>-0.002518</td>\n",
       "      <td>-0.041641</td>\n",
       "      <td>0.026969</td>\n",
       "      <td>-0.014801</td>\n",
       "      <td>-0.014127</td>\n",
       "      <td>-0.061637</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.098168</td>\n",
       "      <td>-0.031694</td>\n",
       "      <td>-0.052128</td>\n",
       "      <td>0.014774</td>\n",
       "      <td>-0.091150</td>\n",
       "      <td>0.001324</td>\n",
       "      <td>0.053866</td>\n",
       "      <td>-0.083904</td>\n",
       "      <td>0.037684</td>\n",
       "      <td>0.002314</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>-0.095983</td>\n",
       "      <td>-0.063012</td>\n",
       "      <td>-0.116906</td>\n",
       "      <td>-0.059075</td>\n",
       "      <td>-0.051323</td>\n",
       "      <td>-0.003439</td>\n",
       "      <td>0.018687</td>\n",
       "      <td>0.006544</td>\n",
       "      <td>-0.049057</td>\n",
       "      <td>-0.031649</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.041085</td>\n",
       "      <td>-0.008593</td>\n",
       "      <td>-0.021544</td>\n",
       "      <td>-0.021112</td>\n",
       "      <td>-0.019502</td>\n",
       "      <td>0.050040</td>\n",
       "      <td>-0.029175</td>\n",
       "      <td>0.005498</td>\n",
       "      <td>0.152892</td>\n",
       "      <td>0.024720</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>-0.011600</td>\n",
       "      <td>0.056510</td>\n",
       "      <td>0.016624</td>\n",
       "      <td>-0.094690</td>\n",
       "      <td>-0.009865</td>\n",
       "      <td>0.072347</td>\n",
       "      <td>0.044124</td>\n",
       "      <td>-0.041175</td>\n",
       "      <td>-0.042124</td>\n",
       "      <td>-0.102631</td>\n",
       "      <td>...</td>\n",
       "      <td>-0.135239</td>\n",
       "      <td>0.013612</td>\n",
       "      <td>-0.049410</td>\n",
       "      <td>-0.006925</td>\n",
       "      <td>0.085355</td>\n",
       "      <td>-0.007875</td>\n",
       "      <td>0.030402</td>\n",
       "      <td>-0.029012</td>\n",
       "      <td>0.001888</td>\n",
       "      <td>-0.000133</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>13 rows × 384 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "         0         1         2         3         4         5         6    \\\n",
       "0  -0.023889  0.055259 -0.011655 -0.033414 -0.012261 -0.024873 -0.012663   \n",
       "1  -0.012688  0.046874 -0.010502 -0.020384 -0.013361  0.042322  0.016628   \n",
       "2   0.000494  0.119412  0.005229 -0.092734  0.007773 -0.005325  0.034506   \n",
       "3  -0.029711  0.023298 -0.057041 -0.012183 -0.013710  0.029796  0.063739   \n",
       "4  -0.025628  0.070389 -0.017380 -0.056567  0.028577  0.052823  0.067063   \n",
       "5  -0.022656  0.021160  0.005105 -0.046494  0.009074  0.041495  0.054268   \n",
       "6  -0.002911  0.060791 -0.009176 -0.006133  0.040492  0.036594  0.002054   \n",
       "7  -0.080526  0.059888 -0.048847 -0.040176 -0.063342  0.041848  0.119045   \n",
       "8  -0.034388  0.072501  0.014440 -0.036695  0.014019  0.063070  0.034683   \n",
       "9  -0.005964  0.025044 -0.003182 -0.025243 -0.039823 -0.012772  0.044713   \n",
       "10 -0.039008 -0.010609 -0.007383 -0.050190 -0.002518 -0.041641  0.026969   \n",
       "11 -0.095983 -0.063012 -0.116906 -0.059075 -0.051323 -0.003439  0.018687   \n",
       "12 -0.011600  0.056510  0.016624 -0.094690 -0.009865  0.072347  0.044124   \n",
       "\n",
       "         7         8         9    ...       374       375       376       377  \\\n",
       "0   0.025346  0.018508 -0.083508  ... -0.161688 -0.046426  0.006004  0.005281   \n",
       "1  -0.004099 -0.002607 -0.010188  ... -0.061594 -0.020717 -0.009082 -0.029260   \n",
       "2  -0.051981 -0.006265 -0.006111  ... -0.108326 -0.049646 -0.073399 -0.029898   \n",
       "3   0.001101 -0.045124 -0.040748  ... -0.117682  0.031924  0.000854  0.020200   \n",
       "4  -0.052618 -0.054702 -0.116230  ... -0.118145  0.013343 -0.055188 -0.032723   \n",
       "5  -0.024185 -0.013483 -0.075966  ... -0.100110  0.010750 -0.031469 -0.004822   \n",
       "6  -0.031345  0.031806 -0.023495  ... -0.028763 -0.060458 -0.018598 -0.040189   \n",
       "7   0.010652 -0.030095 -0.004561  ... -0.144566  0.020404  0.023088  0.005077   \n",
       "8  -0.014531 -0.059862 -0.045383  ... -0.114763 -0.035894 -0.019877 -0.033375   \n",
       "9   0.014535 -0.038213 -0.041149  ... -0.057621  0.021594  0.048983 -0.044541   \n",
       "10 -0.014801 -0.014127 -0.061637  ... -0.098168 -0.031694 -0.052128  0.014774   \n",
       "11  0.006544 -0.049057 -0.031649  ... -0.041085 -0.008593 -0.021544 -0.021112   \n",
       "12 -0.041175 -0.042124 -0.102631  ... -0.135239  0.013612 -0.049410 -0.006925   \n",
       "\n",
       "         378       379       380       381       382       383  \n",
       "0  -0.003342  0.027754  0.020411  0.005778  0.034098 -0.006889  \n",
       "1  -0.066253  0.065257  0.013229 -0.023103 -0.002785  0.010474  \n",
       "2  -0.102734  0.062121  0.034606  0.016877 -0.023861  0.005264  \n",
       "3  -0.020666 -0.005167  0.038370  0.003617  0.033993 -0.010255  \n",
       "4   0.008436  0.019169  0.048212 -0.040412  0.083346  0.026855  \n",
       "5   0.039657  0.026384  0.045514  0.059089 -0.017509  0.007166  \n",
       "6  -0.031486 -0.018299  0.002286 -0.073420  0.016235 -0.000244  \n",
       "7  -0.055645 -0.007675  0.050791 -0.005989  0.134562  0.034817  \n",
       "8  -0.030168  0.039412  0.044993  0.000578 -0.025124  0.034191  \n",
       "9  -0.030137  0.006779  0.054854  0.029937  0.070214  0.041565  \n",
       "10 -0.091150  0.001324  0.053866 -0.083904  0.037684  0.002314  \n",
       "11 -0.019502  0.050040 -0.029175  0.005498  0.152892  0.024720  \n",
       "12  0.085355 -0.007875  0.030402 -0.029012  0.001888 -0.000133  \n",
       "\n",
       "[13 rows x 384 columns]"
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import pandas as pd\n",
    "embeddings = pd.DataFrame(output)\n",
    "embeddings"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "id": "9ac9b882-df78-4bda-8ae5-257171d9890c",
   "metadata": {},
   "outputs": [],
   "source": [
    "embeddings.to_csv(\"embeddings.csv\", index=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "id": "6d573657-d483-441b-afbb-643f487815c5",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "tensor([[-8.9692e-02, -7.1678e-02, -6.4658e-02, -2.5273e-02, -2.5160e-02,\n",
       "          9.5493e-02,  6.0537e-02,  6.5189e-03,  7.0210e-02,  1.6540e-02,\n",
       "          3.1756e-02,  3.7128e-02, -3.0189e-02,  1.2188e-01,  4.2055e-03,\n",
       "          4.7994e-02,  9.5993e-02,  2.8378e-02,  6.5093e-02, -3.7466e-02,\n",
       "          1.8294e-02, -1.3735e-02,  6.9921e-02,  1.0683e-02, -2.6517e-02,\n",
       "         -6.4150e-03, -1.4047e-02, -3.0414e-02, -1.2173e-01, -8.3550e-02,\n",
       "          4.4605e-02,  1.8618e-02, -4.5440e-02, -5.3226e-02, -5.2821e-02,\n",
       "          6.1405e-02, -5.6014e-03, -6.7444e-02, -2.9687e-02, -3.2697e-02,\n",
       "         -9.0033e-02, -5.4642e-03,  7.9094e-02, -1.6152e-02,  9.2060e-02,\n",
       "         -2.1775e-02,  3.0855e-02, -2.7018e-02,  5.1785e-02,  2.2410e-02,\n",
       "          4.5925e-03,  6.0932e-03, -6.1588e-02, -4.3769e-04,  1.4080e-02,\n",
       "         -1.0000e-01, -5.5338e-02, -4.2764e-02,  3.1288e-02, -8.6337e-02,\n",
       "         -1.2676e-03, -1.8121e-03, -4.2850e-03, -2.9365e-02,  3.6735e-02,\n",
       "         -6.6461e-03,  5.2725e-02, -4.1446e-02, -1.7163e-02,  5.2195e-02,\n",
       "         -3.5301e-02, -1.1078e-02, -8.1348e-03, -6.7892e-02, -7.6523e-02,\n",
       "         -4.1602e-02, -2.3622e-02, -3.7206e-02, -9.2386e-02, -4.3152e-02,\n",
       "          4.9173e-02, -1.2231e-01, -1.2079e-01,  2.5151e-02,  2.3995e-02,\n",
       "         -2.4697e-03, -1.4411e-02, -2.8515e-04,  5.7351e-03,  6.1428e-02,\n",
       "         -7.7035e-02,  3.1017e-02, -1.0668e-02,  8.4897e-02, -3.5265e-02,\n",
       "         -2.0904e-02, -1.8331e-02, -2.1771e-02, -4.5067e-02,  6.3914e-02,\n",
       "          2.5410e-02, -1.0044e-02, -7.8166e-02, -3.2381e-02,  1.3421e-01,\n",
       "         -3.8063e-02,  1.1250e-01, -6.6807e-02, -2.6270e-02,  3.0373e-02,\n",
       "         -4.7775e-03, -7.2811e-02,  6.6593e-03,  3.0932e-02,  5.7442e-02,\n",
       "          1.6413e-02,  8.1363e-02,  2.4339e-02, -3.8978e-02,  4.2294e-03,\n",
       "          9.0345e-02,  1.3644e-02,  6.1808e-02, -7.1033e-03, -2.0219e-03,\n",
       "         -2.5045e-02,  4.6670e-02, -2.7020e-33, -3.0658e-02, -3.1585e-02,\n",
       "          5.6400e-02,  3.3047e-02,  4.2517e-02,  1.6862e-02, -1.1733e-02,\n",
       "         -3.6467e-02, -1.9978e-02,  1.1683e-02, -1.1001e-01, -5.7765e-02,\n",
       "         -5.5602e-02, -1.1054e-02,  8.1563e-02,  4.0051e-02, -2.3544e-02,\n",
       "          3.9336e-02,  2.9382e-02, -1.7138e-02, -6.1261e-02,  1.0746e-01,\n",
       "         -6.7021e-02,  7.3112e-03, -3.8741e-02, -1.1130e-02, -2.4723e-03,\n",
       "          2.9728e-02,  2.0914e-03, -4.8236e-03,  2.8769e-02, -9.3932e-03,\n",
       "         -4.1794e-03,  6.4001e-02,  1.3524e-01, -3.2297e-02, -7.8227e-02,\n",
       "         -3.4412e-02, -3.1194e-02,  2.8607e-02, -3.1381e-02,  3.9271e-02,\n",
       "         -5.4559e-02,  4.3373e-02,  3.1618e-02,  3.2962e-02,  1.4340e-02,\n",
       "          6.3454e-02,  1.2816e-02,  8.8069e-02,  9.7940e-03,  3.4391e-03,\n",
       "          3.8793e-02,  9.7933e-03, -4.0707e-02,  2.9351e-02,  1.6331e-02,\n",
       "         -1.9151e-02,  4.2998e-02,  1.3868e-03, -1.5496e-02,  2.8651e-02,\n",
       "         -1.6117e-02,  4.8554e-02, -3.3424e-02,  3.7980e-02,  5.1681e-02,\n",
       "          9.4712e-03,  2.1594e-02, -2.7505e-02, -3.4454e-02,  3.3451e-02,\n",
       "          5.0620e-02, -6.9366e-02,  6.2185e-02, -1.2269e-02,  3.8187e-02,\n",
       "         -4.1367e-02, -7.7467e-02, -5.4399e-02, -8.7326e-02, -3.0441e-03,\n",
       "         -1.8627e-02,  4.1645e-02, -3.1147e-03,  8.9177e-03, -5.0913e-02,\n",
       "         -9.3077e-02, -4.5287e-03,  6.0444e-02, -1.0301e-01, -9.1961e-02,\n",
       "          6.9155e-02,  3.0234e-02,  9.0851e-02,  3.2439e-33,  8.6552e-02,\n",
       "         -6.5429e-02,  7.8963e-03,  4.3653e-02,  5.5929e-02,  7.0854e-03,\n",
       "         -7.0919e-02,  1.4281e-04,  8.3507e-02,  6.8680e-02, -1.4401e-02,\n",
       "         -3.4416e-03,  4.6490e-02,  7.7277e-03,  1.1520e-01, -2.2469e-02,\n",
       "          4.4533e-02, -4.1014e-02,  5.2622e-02,  2.5087e-02,  3.6982e-02,\n",
       "          5.2463e-02, -3.0043e-02, -1.0178e-02,  3.0303e-02,  4.1595e-02,\n",
       "         -2.8276e-02,  3.7373e-02, -3.4403e-02, -1.0499e-02, -2.0811e-02,\n",
       "         -2.3120e-02,  4.5837e-02,  5.1766e-02, -5.1619e-02,  8.7256e-02,\n",
       "          1.6761e-02, -2.1394e-03,  3.6348e-03,  5.0054e-02,  2.0227e-02,\n",
       "         -1.6015e-02, -2.1217e-02,  1.5421e-01, -1.3158e-02, -2.8398e-02,\n",
       "         -1.3689e-02,  4.7356e-02, -5.7805e-02,  9.0794e-03, -1.1677e-01,\n",
       "          1.1524e-02, -7.1354e-02, -7.0080e-02,  7.9298e-02,  1.6545e-02,\n",
       "          2.4228e-02,  6.2592e-03, -1.4449e-02, -1.2710e-02, -3.4715e-02,\n",
       "          4.9897e-04, -5.4645e-02,  6.3109e-04, -1.5480e-02,  3.5777e-02,\n",
       "          6.8206e-03,  1.9068e-02, -2.4766e-02, -1.0899e-02, -2.5103e-02,\n",
       "         -6.4506e-03, -5.4571e-02,  2.5454e-02, -9.5684e-03, -3.7722e-02,\n",
       "          6.2204e-02, -1.7215e-02,  5.9117e-02, -3.8532e-02,  1.3672e-02,\n",
       "          2.5865e-02, -1.5777e-02,  5.1845e-02,  1.2019e-02,  1.2119e-01,\n",
       "         -1.8528e-02,  1.3776e-02,  1.1833e-03,  8.2213e-02,  3.8837e-02,\n",
       "          1.3432e-02,  1.3018e-01, -2.1637e-02, -8.7439e-02, -1.1291e-08,\n",
       "         -4.3203e-02,  1.0041e-01,  1.7602e-02, -6.4081e-02, -1.2244e-02,\n",
       "         -1.4865e-02, -7.1396e-02,  1.0025e-01,  3.0179e-02,  5.5649e-02,\n",
       "          2.0928e-02,  5.4815e-03,  3.5794e-02,  3.0769e-02, -7.5556e-02,\n",
       "          4.9906e-04,  3.8390e-02, -3.8530e-02, -4.8088e-02,  1.2520e-02,\n",
       "          9.9632e-03,  3.6153e-03,  6.6720e-02, -5.6117e-02, -2.8780e-02,\n",
       "          2.7026e-02, -4.5948e-02, -3.1805e-02,  3.7404e-02,  1.4018e-01,\n",
       "          7.4267e-02,  5.3000e-03, -3.6980e-02,  1.1275e-03, -8.6605e-02,\n",
       "         -6.6038e-02,  4.8514e-02,  6.1135e-03,  5.5289e-03, -4.0952e-02,\n",
       "         -3.3284e-02,  4.5587e-02,  3.3399e-02, -5.0551e-02,  1.5164e-02,\n",
       "          8.0977e-02,  3.3518e-02, -1.7935e-01,  4.1962e-02, -1.6916e-02,\n",
       "          1.1325e-02, -4.0028e-02, -4.4969e-02,  8.2986e-02,  4.9503e-02,\n",
       "          1.1134e-01,  5.6467e-03,  2.0734e-03, -3.6509e-02,  2.9235e-02,\n",
       "          1.1157e-01, -8.2191e-02, -1.8864e-02,  3.1457e-02]])"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import torch\n",
    "\n",
    "question = [\"Best action movie?\"]\n",
    "output = query(question)\n",
    "\n",
    "query_embeddings = torch.FloatTensor(output)\n",
    "query_embeddings"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "beb947b2-5cf2-42f8-bfc0-e2c5dd33ba49",
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "2ad5f317-769d-41b6-8dcb-eaf3983e1f8a",
   "metadata": {},
   "outputs": [],
   "source": [
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "833f206f-bd61-41ab-a79e-c0fdf52159d1",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}