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 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 |
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 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() |
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
| class ReportFormat(object): | |
| PDF = 0 | |
| TEXT = 1 | |
| class Report(object): | |
| def __init__(self, format_): | |
| self.title = 'title' | |
| self.format_ = format_ |
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
| // 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 |
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 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', |
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
| from sqlalchemy.dialects import postgresql | |
| def bulk_upsert(session: Session, | |
| items: Sequence[Mapping[str, Any]]): | |
| session.execute( | |
| postgresql.insert(MyModel.__table__) | |
| .values(items) | |
| .on_conflict_do_update( | |
| index_elements=[MyModel.id], | |
| set_={MyModel.my_field.name: 'new_value'}, |
Short (72 chars or less) summary
More detailed explanatory text. Wrap it to 72 characters. The blank
line separating the summary from the body is critical (unless you omit
the body entirely).
Write your commit message in the imperative: "Fix bug" and not "Fixed
bug" or "Fixes bug." This convention matches up with commit messages
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
| #!/usr/bin/env python | |
| import requests | |
| import hashlib | |
| page_contents = requests.get('http://www.google.com') | |
| response = page_contents.text | |
| print hashlib.sha256(response.encode('utf-8')).hexdigest() |
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
| # Safe Queue Celery App Settings | |
| from __future__ import absolute_import, unicode_literals | |
| from celery import Celery | |
| app = Celery('some_project', | |
| broker='amqp://', | |
| backend='amqp://', | |
| include=['some_project.tasks']) |
NewerOlder