Skip to content

Instantly share code, notes, and snippets.

View fmelihh's full-sized avatar
:atom:
Beast Mode

Furkan Melih Ercan fmelihh

:atom:
Beast Mode
View GitHub Profile
@ghandic
ghandic / pandas_s3.py
Last active June 5, 2023 11:40
Load csv from S3 directly into memory and write to S3 directly from memory by extending pd.DataFrame class
import boto3
import pandas as pd
from io import StringIO
class S3DataFrame(pd.DataFrame):
"""
# Make a dataframe and upload it as csv
s3df = S3DataFrame({'h1':[1], 'h2':[2]})
s3df.to_s3(Bucket='bucket-name',
// HTTPError implements ClientError interface.
type HTTPError struct {
Cause error `json:"-"`
Detail string `json:"detail"`
Status int `json:"-"`
}
func (e *HTTPError) Error() string {
if e.Cause == nil {
return e.Detail
@farhadmpr
farhadmpr / chain-of-responsibility.py
Created December 25, 2019 07:42
Chain of responsibility design pattern in python
class ReportFormat(object):
PDF = 0
TEXT = 1
class Report(object):
def __init__(self, format_):
self.title = 'title'
self.format_ = format_
@philippegirard
philippegirard / main.py
Created April 18, 2020 20:18
fastapi logging middleware
import logging
from fastapi import FastAPI
from uicheckapp.services import EchoService
logging.config.fileConfig('logging.conf', disable_existing_loggers=False)
logger = logging.getLogger(__name__)
app = FastAPI()
@lisakim0
lisakim0 / app.py
Created January 24, 2025 06:26
A Retrieval-Augmented Generation (RAG) system for PDF document analysis using DeepSeek-R1 and Ollama.
import streamlit as st
from langchain_community.document_loaders import PDFPlumberLoader
from langchain_experimental.text_splitter import SemanticChunker
from langchain_community.embeddings import HuggingFaceEmbeddings
from langchain_community.vectorstores import FAISS
from langchain_community.llms import Ollama
from langchain.prompts import PromptTemplate
from langchain.chains.llm import LLMChain
from langchain.chains.combine_documents.stuff import StuffDocumentsChain
from langchain.chains import RetrievalQA