Skip to content

Instantly share code, notes, and snippets.

View saas-coder's full-sized avatar

Ninja saas-coder

  • Entrepreneur
  • Morocco
  • 00:15 (UTC -12:00)
View GitHub Profile
function initFacebookAdDownloader() {
// Queue to store pending GraphQL responses
const processingQueue = {
items: [],
isProcessing: false,
processDelay: 500, // Delay between processing items
async add(response) {
this.items.push(response);
if (!this.isProcessing) {
// Function to check if an ad has EU data without fetching the full data
async function checkEUDataEligibility(requestIndex, adID) {
// Check if we already have information about this ad
const collectionIndex = findCollectionIndex(adsCollections, adID);
if (collectionIndex === -1) return false;
const adIndex = findAdIndex(adsCollections[collectionIndex], adID);
if (adIndex === -1) return false;
const ad = adsCollections[collectionIndex][adIndex];

Complete Example Structure

1. Create Main Marketing Folder

curl -X POST "https://mongo.fillcreative.io/api/folders/create" \
  -H "Content-Type: application/json" \
  -d '{
    "user_id": "test",
    "name": "Marketing Campaigns 2024"
  }'
{
"data": [
{
"id": "m975975870876394",
"version": "v1",
"brand": {
"id": "m103697922099853",
"page_id": "103697922099853",
"name": "Investing Journal",
"avatar_url": "https://cdn.tryatria.com/adfiles/m975975870876394_vgOxxk9-W4M.jpeg",

توضيح كود نظام الأسئلة والأجوبة (RAG)

في هذا المستند، سنقوم بشرح مفصل لكود نظام الأسئلة والأجوبة (RAG) المطبق في ملف Python. سنتناول كيفية عمل النظام من الأساسيات إلى التفاصيل التقنية، بما في ذلك تقسيم المستندات، التضمين (embedding)، ونظام البحث القائم على FAISS.

مقدمة

نظام الأسئلة والأجوبة (RAG) هو نظام يتعامل مع استخراج المعلومات من مستندات نصية للإجابة على الأسئلة بناءً على المحتوى المستخرج. يتضمن هذا النظام عدة خطوات أساسية: تحميل المستندات، تقسيم النصوص، إنشاء قاعدة بيانات بحثية، والتعامل مع نموذج ذكاء اصطناعي للإجابة على الأسئلة.

كيفية عمل نظام RAG

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say voice="woman" language="es-ES"> Hola cómo estás </Say>
</Response>
import librosa
import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
def plot_spectrogram(sound, sr):
S = librosa.feature.melspectrogram(sound, sr=sr)
log_S = librosa.power_to_db(S, ref=np.max)
plt.figure(figsize=(12, 4))
librosa.display.specshow(log_S, sr=sr, x_axis='time', y_axis='mel')
import numpy as np
from scipy.fftpack import fft
def vehicle_condition_detection(acc_info, g, h, h_prime, h_1, h_2, T):
time = 0
vehicle_condition = "Unknown"
while True:
for t in range(len(acc_info)):
Ax, Ay, Az = acc_info[t]
urls = """https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/sentinel-2-part1.zip
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/extra_train-planet-dec17.zip
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/extra_train-planet-jun18.zip
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/starter-notebook.ipynb
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/extra_train-sentinel.zip
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/sentinel_for_points_collected_in_2015.zip
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/extra_train-planet-jun17.zip
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/files/extra_train-planet-dec18.zip
https://api.zindi.africa/v1/competitions/lacuna-correct-field-detection-challenge/f
# installation
!pip install knockknock #For sending message to telegram
# Importation
from knockknock import telegram_sender
from kaggle_secrets import UserSecretsClient
user_secrets = UserSecretsClient()
token = user_secrets.get_secret("token")
chat_id = user_secrets.get_secret("chat_id")