This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dspy | |
from typing import List, Dict, Optional | |
import json | |
import os | |
# Configuration du modèle Gemini Flash | |
lm = dspy.LM("gemini/gemini-2.0-flash", api_key="YOUR_GEMINI_API_KEY") | |
dspy.configure(lm=lm) | |
# Signature pour la validation d'affiches avec scoring |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
api_key = os.environ.get("MISTRAL_API_KEY") # Remplacez par votre clé réelle | |
def transcription_from_audio(audio_file_path: str) -> str: | |
""" | |
Envoie un fichier audio à l'API Mistral pour transcription. | |
Retourne le texte transcrit. | |
""" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Audio Preprocessing Mini-Pipeline | |
This module implements a comprehensive audio preprocessing pipeline designed to optimize audio samples. The preprocessing steps ensure consistent | |
audio quality and format while removing noise and silent segments that could interfere | |
Libraries Used: | |
- librosa: Advanced audio analysis and feature extraction library | |
- numpy: Numerical computing for array operations and mathematical transformations | |
- noisereduce: Spectral gating noise reduction using signal processing techniques |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dspy | |
import json | |
# Configuration du LLM | |
lm = dspy.LM('openai/mistral-small-latest', api_key='CLE-API', api_base='https://api.mistral.ai/v1') | |
dspy.configure(lm=lm) | |
# === MODULE 1: Générateur de requêtes utilisateur === | |
class UserRequestSignature(dspy.Signature): |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#libraries | |
import math | |
import pandas as pd | |
import numpy as np | |
import random | |
def distance(a,b): | |
return math.sqrt(((a[0]-b[0])**2)+(a[1]-b[1])**2) | |
def dist_from_centroid(points,c): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_something(elements,chaine): | |
elements_temp=[] | |
for i in elements: | |
elements_temp.extend(list(i)) | |
elements=elements_temp | |
elements =[re.escape(elem) for elem in elements] | |
resultat = "|".join([f"{elem}" for elem in elements]) | |
text=chaine | |
matches = re.findall(r'!\[([^\]]+)\]\(([^)]+)\)', text) | |
to_find=[] |