This file contains 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
""" | |
pip install lightrag-hku | |
""" | |
import os | |
import asyncio | |
import numpy as np | |
from tqdm import tqdm | |
from lightrag import LightRAG, QueryParam | |
from lightrag.llm.openai import gpt_4o_mini_complete, gpt_4o_complete, openai_embed, openai_complete_if_cache |
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 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 streamlit as st | |
from streamlit_feedback import streamlit_feedback | |
import logging | |
import uuid | |
logging.basicConfig(level=logging.INFO) | |
def reset_key(): | |
st.session_state['ss_key'] = str(uuid.uuid4()) |
This file contains 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 streamlit as st | |
if 'messages' not in st.session_state: | |
st.session_state['messages'] = [{ | |
'role': 'assistant', 'content': "Do you have a question for me ?" | |
}] | |
with st.container(height=500): |
This file contains 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 is_prime_number(x): | |
''' Function to know if x is a prime number. | |
''' | |
for i in range(floor(sqrt(x))): | |
if x % i == 0: | |
return False | |
return True | |
def sieve_of_eratosthenes(start, end): | |
''' Brute force method to compute primes. |
This file contains 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
pillow : img.show() | |
opencv: | |
cv2.namedWindow('image', cv2.WINDOW_NORMAL) | |
cv2.imshow('image',croppedImg) | |
cv2.waitKey(0) | |
cv2.destroyAllWindows() |
This file contains 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
https://www.digitalocean.com/community/tutorials/how-to-handle-plain-text-files-in-python-3 | |
#from list of tuples | |
class Person(object): | |
def __init__(self, name, profession): | |
self.name = name | |
self.profession = profession | |
people = [Person("Nick", "Programmer"), Person("Alice","Engineer")] | |
professions = dict([ (p.name, p.profession) for p in people ]) |
This file contains 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 drawMask(width, height, coordinatesList): | |
mask = np.zeros((height,width,3), np.uint8) | |
color = (255,255,255) | |
for coordinates in coordinatesList: | |
cv2.fillConvexPoly(mask, np.array(coordinates, 'int32'), color) | |
return mask |
This file contains 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
from lxml import etree | |
def getSifts(xmlFilePath): | |
doc = etree.parse(xmlFilePath) | |
pags = doc.xpath('//PAG') | |
pag = pags[0] | |
sifts = pag.xpath('SIFTMATCHER') | |
return sifts | |
for sift in sifts : |
This file contains 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
pour faire un clean d'un .sh édité avec un éditeur de texte standard (different de vi) | |
tr -d '\r' < export.sh > export_clean.sh |
NewerOlder