id
int64
0
190k
prompt
stringlengths
21
13.4M
docstring
stringlengths
1
12k
168,277
import json import os from dataclasses import asdict, dataclass from pathlib import Path from typing import Any, Dict, List, Optional, Type, TypeVar, Union from huggingface_hub import ModelHubMixin, hf_hub_download The provided code snippet includes necessary dependencies for implementing the `prepare_dialogue` functi...
Format example to single- or multi-turn dialogue.
168,278
import json import os from dataclasses import asdict, dataclass from pathlib import Path from typing import Any, Dict, List, Optional, Type, TypeVar, Union from huggingface_hub import ModelHubMixin, hf_hub_download IGNORE_INDEX = -100 The provided code snippet includes necessary dependencies for implementing the `mask...
Masks the user turns of a dialogue from the loss
168,279
import os import re, json from typing import Dict, List, Any import requests from langchain.chains import LLMChain from langchain.prompts import PromptTemplate from langchain.llms import BaseLLM from pydantic import BaseModel, Field from langchain.chains.base import Chain from langchain.chat_models import ChatOpenAI f...
null
168,280
import streamlit as st import requests def initialize_session_state(): if "is_dark_theme" not in st.session_state: st.session_state.is_dark_theme = False
null
168,281
import streamlit as st import requests def get_walmart_bot_response(user_input): endpoint = "http://localhost:5000/walmartbot" data = {"messages": [user_input]} response = requests.post(endpoint, json=data) return response.json()
null
168,282
import streamlit as st import requests def get_searchgpt_response(user_input): endpoint = "http://localhost:5000/searchgpt" reply = requests.post(endpoint, json={"text": user_input}) response = {"messages": [reply.json()]} return response
null
168,283
import streamlit as st import requests def display_response(response, user_input, prev_messages): if "messages" in response: for message in response["messages"]: st.text(f"Bot: 💬 {message}") if "sources" in response: for source in response["sources"]: st.text(f"Source:...
null
168,284
import streamlit as st import requests def apply_theme(): # Check if dark theme is enabled is_dark_theme = st.session_state.get("is_dark_theme", False) # Apply the theme based on the user's choice if is_dark_theme: st.markdown( """ <style> body { ...
null
168,285
import streamlit as st import requests def toggle_theme(): st.session_state.is_dark_theme = not st.session_state.is_dark_theme # Use this to rerun the script when the button is clicked st.rerun()
null
168,286
from search_capabilities import * from walmart_functions import * from fastapi import FastAPI, HTTPException from pydantic import BaseModel from typing import List from fastapi.middleware.cors import CORSMiddleware class ConversationRequest(BaseModel): messages: List[str] sales_agent = SalesGPT.from_llm(llm, verbos...
null
168,287
from search_capabilities import * from walmart_functions import * from fastapi import FastAPI, HTTPException from pydantic import BaseModel from typing import List from fastapi.middleware.cors import CORSMiddleware class ChatResponse(BaseModel): text: str def handle_chat(request: ChatResponse): try: # ...
null
168,288
import requests import os from dotenv import load_dotenv from langchain.agents import initialize_agent, Tool from langchain.agents import AgentType from langchain.chat_models import ChatOpenAI from langchain.prompts import MessagesPlaceholder from langchain.chains.conversation.memory import ConversationBufferWindowMemo...
null
168,289
import requests import os from dotenv import load_dotenv from langchain.agents import initialize_agent, Tool from langchain.agents import AgentType from langchain.chat_models import ChatOpenAI from langchain.prompts import MessagesPlaceholder from langchain.chains.conversation.memory import ConversationBufferWindowMemo...
null
168,290
from fastapi import FastAPI, Depends, File, UploadFile, HTTPException from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from fastapi import Request from config import settings import typing as t import uvicorn import os from qdrant_engine import QdrantIndex async def root(request: Reque...
null
168,291
from fastapi import FastAPI, Depends, File, UploadFile, HTTPException from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from fastapi import Request from config import settings import typing as t import uvicorn import os from qdrant_engine import QdrantIndex qdrant_index = QdrantIndex(set...
null
168,292
from fastapi import FastAPI, Depends, File, UploadFile, HTTPException from fastapi.middleware.cors import CORSMiddleware from pydantic import BaseModel from fastapi import Request from config import settings import typing as t import uvicorn import os from qdrant_engine import QdrantIndex qdrant_index = QdrantIndex(set...
null
168,293
import os import numpy as np from llama_index import ServiceContext, VectorStoreIndex, StorageContext, load_index_from_storage from llama_index.node_parser import SentenceWindowNodeParser, HierarchicalNodeParser, get_leaf_nodes from llama_index.indices.postprocessor import MetadataReplacementPostProcessor, SentenceTran...
null
168,294
import os import numpy as np from llama_index import ServiceContext, VectorStoreIndex, StorageContext, load_index_from_storage from llama_index.node_parser import SentenceWindowNodeParser, HierarchicalNodeParser, get_leaf_nodes from llama_index.indices.postprocessor import MetadataReplacementPostProcessor, SentenceTran...
null
168,295
import os import numpy as np from llama_index import ServiceContext, VectorStoreIndex, StorageContext, load_index_from_storage from llama_index.node_parser import SentenceWindowNodeParser, HierarchicalNodeParser, get_leaf_nodes from llama_index.indices.postprocessor import MetadataReplacementPostProcessor, SentenceTran...
null
168,296
import os import numpy as np from llama_index import ServiceContext, VectorStoreIndex, StorageContext, load_index_from_storage from llama_index.node_parser import SentenceWindowNodeParser, HierarchicalNodeParser, get_leaf_nodes from llama_index.indices.postprocessor import MetadataReplacementPostProcessor, SentenceTran...
null
168,297
import os import numpy as np from llama_index import ServiceContext, VectorStoreIndex, StorageContext, load_index_from_storage from llama_index.node_parser import SentenceWindowNodeParser, HierarchicalNodeParser, get_leaf_nodes from llama_index.indices.postprocessor import MetadataReplacementPostProcessor, SentenceTran...
null
168,298
from setuptools import setup, find_packages from typing import List REQUIREMENTS_FILE_NAME = "requirements.txt" HYPHEN_E_DOT = "-e ." List = _Alias() def get_requirements_list()->List[str]: with open(REQUIREMENTS_FILE_NAME) as requirement_file: requirement_list = requirement_file.readlines() requi...
null
168,299
from flask import Flask from video_summarizer.logger import logging from video_summarizer.exception import CustomException import os, sys import logging logging.basicConfig(filename=log_file_path, filemode='w', format='[%(asctime)s] %(name)s - %(levelname)s - %(message)s'...
null
168,300
import os from flask import Flask, render_template, request, send_from_directory from video_summarizer.components.video_to_subtitle import SubtitleGenerator, Video2SubConfig from video_summarizer.components.summarize import Summarizer from video_summarizer.pipeline import run_training_pipeline import threading from gtt...
It renders the index.html file in the templates folder Returns: The index.html file is being returned.
168,301
import os from flask import Flask, render_template, request, send_from_directory from video_summarizer.components.video_to_subtitle import SubtitleGenerator, Video2SubConfig from video_summarizer.components.summarize import Summarizer from video_summarizer.pipeline import run_training_pipeline import threading from gtt...
The function upload_file() takes in a video file or a video link, transcribes the video, and summarizes the transcript Returns: the transcript and summary text.
168,302
import os from flask import Flask, render_template, request, send_from_directory from video_summarizer.components.video_to_subtitle import SubtitleGenerator, Video2SubConfig from video_summarizer.components.summarize import Summarizer from video_summarizer.pipeline import run_training_pipeline import threading from gtt...
null
168,303
import os from flask import Flask, render_template, request, send_from_directory from video_summarizer.components.video_to_subtitle import SubtitleGenerator, Video2SubConfig from video_summarizer.components.summarize import Summarizer from video_summarizer.pipeline import run_training_pipeline import threading from gtt...
null
168,304
import sys from datetime import timedelta from typing import Iterator, TextIO from video_summarizer.exception import CustomException def format_timestamp(seconds: float, always_include_hours: bool = False): """ It takes a float representing a number of seconds, and returns a string representing the same number ...
It takes a transcript and a file object, and writes the transcript to the file in SRT format -> SubRip subTitle Args: transcript (Iterator[dict]): Iterator[dict] file (TextIO): The file to write the transcript to.
168,305
from flask import Flask from video_summarizer.logger import logging import logging logging.basicConfig(filename=log_file_path, filemode='w', format='[%(asctime)s] %(name)s - %(levelname)s - %(message)s', level=logging.INFO) def index(): logging.in...
null
168,306
from fastapi import FastAPI, APIRouter async def root(): return {"message": "Hello World"}
null
168,307
import secrets import pandas as pd from typing import Callable, Annotated, Union from fastapi import FastAPI, APIRouter, Depends, HTTPException, status, Request, Body, Response from fastapi.responses import JSONResponse from fastapi.security import HTTPBasic, HTTPBasicCredentials, OAuth2PasswordBearer, OAuth2PasswordRe...
null
168,308
import secrets import pandas as pd from typing import Callable, Annotated, Union from fastapi import FastAPI, APIRouter, Depends, HTTPException, status, Request, Body, Response from fastapi.responses import JSONResponse from fastapi.security import HTTPBasic, HTTPBasicCredentials, OAuth2PasswordBearer, OAuth2PasswordRe...
null
168,309
import secrets import pandas as pd from typing import Callable, Annotated, Union from fastapi import FastAPI, APIRouter, Depends, HTTPException, status, Request, Body, Response from fastapi.responses import JSONResponse from fastapi.security import HTTPBasic, HTTPBasicCredentials, OAuth2PasswordBearer, OAuth2PasswordRe...
null
168,310
from datetime import datetime, timedelta from typing import Any, Union, Annotated from fastapi import Depends, HTTPException, status from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from jose import jwt, ExpiredSignatureError, JWTError from passlib.context import CryptContext from app.schema...
null
168,311
from datetime import datetime, timedelta from typing import Any, Union, Annotated from fastapi import Depends, HTTPException, status from fastapi.security import OAuth2PasswordBearer, OAuth2PasswordRequestForm from jose import jwt, ExpiredSignatureError, JWTError from passlib.context import CryptContext from app.schema...
null
168,312
from typing import Callable, Any, List, Optional import json from fastapi import FastAPI, APIRouter, Depends, HTTPException, status, Request, Body, Response from fastapi.routing import APIRoute from fastapi.exceptions import RequestValidationError from app.handlers import log_database_handler import logging def parse_e...
Translates list of raw errors (instances) into list of dicts with name/msg :param raw_errors: List with instances of raw error :return: List of dicts (1 dict for every raw error)
168,313
import pyodbc import pandas as pd from app.core.config import settings def convert_result2dict(cursor): try: result = [] columns = [column[0] for column in cursor.description] for row in cursor.fetchall(): result.append(dict(zip(columns,row))) #print(result) #...
null
168,314
import streamlit as st from stmol import showmol import py3Dmol import requests import biotite.structure.io as bsio st.sidebar.title('🎈 ESMFold') st.sidebar.write('[*ESMFold*](https://esmatlas.com/about) is an end-to-end single sequence protein structure predictor based on the ESM-2 language model. For more informatio...
null
168,315
import langchain import os import streamlit as st import requests import sounddevice as sd import wavio import openai from openai import OpenAI from langchain.prompts import ChatPromptTemplate from langchain.chat_models import ChatOpenAI from langchain.prompts import HumanMessagePromptTemplate from langchain.schema.me...
null
168,316
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,317
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,318
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,319
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,320
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,321
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,322
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,323
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,324
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,325
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,326
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,327
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,328
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,329
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,330
from os import listdir from numpy import array from keras.models import Model from pickle import dump from keras.applications.vgg16 import VGG16 from tensorflow.keras.preprocessing.image import load_img from tensorflow.keras.preprocessing.image import img_to_array from tensorflow.keras.preprocessing.sequence import pad...
null
168,331
import streamlit as st from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.applications.vgg16 import preprocess_input from tensorflow.keras.applications.vgg16 import VGG16 from te...
null
168,332
import streamlit as st from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.applications.vgg16 import preprocess_input from tensorflow.keras.applications.vgg16 import VGG16 from te...
null
168,333
import streamlit as st from tensorflow.keras.models import load_model from tensorflow.keras.preprocessing.text import Tokenizer from tensorflow.keras.preprocessing.sequence import pad_sequences from tensorflow.keras.applications.vgg16 import preprocess_input from tensorflow.keras.applications.vgg16 import VGG16 from te...
null
168,334
from flask import Flask, render_template, request import pandas as pd import numpy as np import sklearn import os import pickle import warnings def home(): return render_template('home.html')
null
168,335
from flask import Flask, render_template, request import pandas as pd import numpy as np import sklearn import os import pickle import warnings loaded_model = pickle.load(open("model.pkl", 'rb')) def predict(): N = int(request.form['Nitrogen']) P = int(request.form['Phosporus']) K = int(request.form['Potas...
null
168,336
from src.ingest_data import ingest_data from src.preprocessing import data_preprocessing from src.hyperparameters import search_hyperparameters from catboost import CatBoostClassifier import pickle def ingest_data()-> pd.DataFrame: data = pd.read_csv("E:\dl\Breast-Cancer-Survival-Prediction\data\data.csv") ret...
null
168,337
import logging from typing import Optional Optional: _SpecialForm = ... def get_console_logger(name:Optional[str]='project') -> logging.Logger: logger = logging.getLogger(name) if not logger.handlers: logger.setLevel(logging.DEBUG) console_handler = logging.StreamHandler() console_hand...
null
168,338
from flask import Flask, render_template, request import openai def index(): return render_template("index.html")
null
168,339
from flask import Flask, render_template, request import openai openai.api_key = 'YOUR_API_KEY' def api(): # Get the message from the POST request message = request.json.get("message") # Send the message to OpenAI's API and receive the response completion = openai.ChatCompletion.create( m...
null
168,340
from fastapi import FastAPI, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse import torch from transformers import pipeline from utils_sum import preprocess_transcript, divide_chunks, Item, clean_transcript import datetime import logging import sys import nltk impo...
null
168,341
import requests import time HOST_URL = "localhost" API_VERSION = "v1.0" PREDICTION_PORT = 8001 def client_script(): # Prediction Module try: st = time.time() result = requests.post(f'http://{HOST_URL}:{PREDICTION_PORT}/{API_VERSION}/prediction', headers={'Conten...
null
168,342
from fastapi import FastAPI, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse from utils_key import Item, final_processing, over_all_key, divide_chunks, NER_transcript, nounKey_nerKey_summary_chunk, clean_transcript, camel from keybert import KeyBERT from keyphrase_...
null
168,343
import requests import time HOST_URL = "localhost" API_VERSION = "v1.0" PREDICTION_PORT = 8001 def client_script(): # Prediction Module try: st = time.time() result = requests.post(f'http://{HOST_URL}:{PREDICTION_PORT}/{API_VERSION}/prediction', headers={'Conte...
null
168,344
from fastapi import FastAPI, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse from utils_topic import Item, get_similarities_model1 from sentence_transformers import SentenceTransformer import datetime import logging import sys import numpy as np import ast import c...
null
168,345
import requests import time HOST_URL = "localhost" API_VERSION = "v1.0" PREDICTION_PORT = 8001 def client_script(): # Prediction Module try: st = time.time() result = requests.post(f'http://{HOST_URL}:{PREDICTION_PORT}/{API_VERSION}/prediction', headers={'Conten...
null
168,346
from fastapi import FastAPI, HTTPException from fastapi.encoders import jsonable_encoder from fastapi.responses import JSONResponse from utils_zero import Item_zeroshot from transformers import pipeline import torch import datetime import logging import sys import ast import configparser logging.basicConfig(level = log...
null
168,347
import requests import time ZERO_URL = "localhost" API_VERSION = "v1.0" ZEROSHOT_PORT = 8001 def client_script(): # Prediction Module try: st = time.time() result = requests.post(f'http://{ZERO_URL}:{ZEROSHOT_PORT}/{API_VERSION}/prediction', headers={'Content-type...
null
168,348
import os import requests from bs4 import BeautifulSoup from datetime import datetime if not os.path.exists(main_directory): os.makedirs(main_directory, exist_ok=True) if not os.path.exists(subdirectory_path): os.makedirs(subdirectory_path, exist_ok=True) response = requests.get(url) class BeautifulSoup(Tag): ...
null
168,349
import streamlit as st import requests import sounddevice as sd import wavio from langchain import OpenAI import os from openai import OpenAI def record_audio(filename, duration, fs): print("Recording audio...") recording = sd.rec(int(duration * fs), samplerate=fs, channels=2) sd.wait() wavio.write(fi...
null
168,350
from setuptools import find_packages, setup from typing import List HYPEN_E_DOT = "-e ." List = _Alias() The provided code snippet includes necessary dependencies for implementing the `get_requirements` function. Write a Python function `def get_requirements(file_path: str) -> List[str]` to solve the following proble...
this function will return the list of requirements
168,351
import os import sys import datetime import numpy as np import pandas as pd import dill import pickle from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.base import BaseEstimator, TransformerMixin from src.exception import CustomExcep...
null
168,352
import os import sys import datetime import numpy as np import pandas as pd import dill import pickle from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.base import BaseEstimator, TransformerMixin from src.exception import CustomExcep...
null
168,353
import os import sys import datetime import numpy as np import pandas as pd import dill import pickle from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.base import BaseEstimator, TransformerMixin from src.exception import CustomExcep...
null
168,354
import os import sys import datetime import numpy as np import pandas as pd import dill import pickle from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.base import BaseEstimator, TransformerMixin from src.exception import CustomExcep...
null
168,355
import os import sys import datetime import numpy as np import pandas as pd import dill import pickle from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.base import BaseEstimator, TransformerMixin from src.exception import CustomExcep...
null
168,356
import os import sys import datetime import numpy as np import pandas as pd import dill import pickle from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from sklearn.pipeline import Pipeline from sklearn.base import BaseEstimator, TransformerMixin from src.exception import CustomExcep...
null
168,357
import sys from src.logger import logging def error_message_detail(error, error_detail: sys): _, _, exc_tb = error_detail.exc_info() file_name = exc_tb.tb_frame.f_code.co_filename error_message = "Error ocurred in python script name [{0}] line number [{1}] error message [{2}]".format( file_name, ex...
null
168,358
import numpy as np from flask import Flask, jsonify, request, render_template from src.pipeline.predict_pipeline import CustomData, PredictRecommendPipeline from src.pipeline.scraping_pipeline import ImageScrappingPipeline from math import trunc from src.logger import logging import os def city_arr(): city_set = se...
null
168,359
import numpy as np from flask import Flask, jsonify, request, render_template from src.pipeline.predict_pipeline import CustomData, PredictRecommendPipeline from src.pipeline.scraping_pipeline import ImageScrappingPipeline from math import trunc from src.logger import logging import os def main_arr(city): loc_set =...
null
168,360
import numpy as np from flask import Flask, jsonify, request, render_template from src.pipeline.predict_pipeline import CustomData, PredictRecommendPipeline from src.pipeline.scraping_pipeline import ImageScrappingPipeline from math import trunc from src.logger import logging import os propType = ['Multistorey Apartmen...
null
168,361
import pandas as pd import numpy as np from pyscript import Element from js import document, window import pickle import warnings def get_predictions(): data = { "ApplicantIncome": document.querySelector("#ApplicantIncome").value, "CoapplicantIncome": document.querySelector("#CoapplicantInc...
null
168,362
import os, sys from os.path import dirname as up from utils.common_libraries import * from utils.constants import * The provided code snippet includes necessary dependencies for implementing the `load_image_from_url` function. Write a Python function `def load_image_from_url(url: str, new_size: tuple = None)` to solve...
Loads an image from a given URL and optionally resizes it. :param url: The URL of the image to load. :type url: str :param new_size: The new size of the image, if resizing is desired. Defaults to None. :type new_size: tuple, optional :return: The loaded image, possibly resized. :rtype: PIL.Image.Image
168,363
import os, sys from os.path import dirname as up from utils.common_libraries import * from utils.constants import * The provided code snippet includes necessary dependencies for implementing the `authenticate_google_service_account_credentials` function. Write a Python function `def authenticate_google_service_account...
Authenticate with Google using a service account. Reads the Google application credentials from an environment variable and creates a service account credential object. Returns: service_account.Credentials: The service account credentials. Raises: RuntimeError: If authentication or logging of the authentication fails.
168,364
import os, sys from os.path import dirname as up from utils.common_libraries import * from utils.constants import * The provided code snippet includes necessary dependencies for implementing the `configure_google_ai_api` function. Write a Python function `def configure_google_ai_api()` to solve the following problem: ...
Configures the Google AI API with the provided API key. Args: api_key (str): The API key for Google AI API. Returns: The configuration object for Google AI API.
168,365
from spacy.lang.en import English from spacy import displacy import re import pandas as pd import spacy import random nlp = English() nlp.add_pipe(nlp.create_pipe('sentencizer')) TRAIN_DATA = outer_list print(outer_list) for ent in doc.ents: print(ent.text, ent.start_char, ent.end_char, ent.label_) spacy.displac...
null
168,366
from setuptools import find_packages, setup def get_requirements(file_path): # requirements = [] with open(file_path) as requirements_obj: requirements = requirements_obj.readlines() requirements = [req.replace("\n","") for req in requirements] if "-e ." in requirements: re...
null
168,367
import os import sys import pickle import dill import numpy as np import pandas as pd from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from src.exception import CustomException class CustomException(Exception): def __init__(self, error_message, error_detail: sys): super...
null
168,368
import os import sys import pickle import dill import numpy as np import pandas as pd from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from src.exception import CustomException class CustomException(Exception): def __init__(self, error_message, error_detail: sys): super...
null
168,369
import os import sys import pickle import dill import numpy as np import pandas as pd from sklearn.metrics import r2_score from sklearn.model_selection import GridSearchCV from src.exception import CustomException class CustomException(Exception): def __init__(self, error_message, error_detail: sys): super...
null
168,370
import sys def error_message_details(error, error_details:sys): # exc_info() returns the information about the error _,_,exc_tb = error_details.exc_info() # get file name from the exc_info() function file_name = exc_tb.tb_frame.f_code.co_filename # construct the error message to return error_...
null
168,371
from flask import Flask, request, render_template import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from src.pipeline.prediction_pipeline import InputData, PreditctPipeline def index(): return render_template('index.html')
null
168,372
from flask import Flask, request, render_template import numpy as np import pandas as pd from sklearn.preprocessing import StandardScaler from src.pipeline.prediction_pipeline import InputData, PreditctPipeline class PreditctPipeline: def __init__(self): pass def predict(self, features): try: ...
null
168,373
import os from wsgiref import simple_server from flask import Flask, request, render_template, jsonify from flask import Response from flask_cors import CORS, cross_origin from src.ML_pipelines.stage_03_prediction import prediction import pickle from src.training_Validation_Insertion import train_validation def home()...
null
168,374
import os from wsgiref import simple_server from flask import Flask, request, render_template, jsonify from flask import Response from flask_cors import CORS, cross_origin from src.ML_pipelines.stage_03_prediction import prediction import pickle from src.training_Validation_Insertion import train_validation model = pic...
null
168,375
import os from wsgiref import simple_server from flask import Flask, request, render_template, jsonify from flask import Response from flask_cors import CORS, cross_origin from src.ML_pipelines.stage_03_prediction import prediction import pickle from src.training_Validation_Insertion import train_validation class trai...
null
168,376
import argparse from src.application_logging.logger import App_Logger from src.utils.common_utils import read_params, save_model,find_best_model import pandas as pd from pathlib import Path from sklearn import linear_model from sklearn import ensemble import sklearn.svm from sklearn.tree import DecisionTreeClassifier i...
Method Name: model_selection_and_tuning Description: Selects a best model from all classification model having best accuracy and auc_roc_score and does hyperparameter tuning Output: Best model selected for each cluster On Failure: Raise Exception Written By: Saurabh Naik Version: 1.0 Revisions: None