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
#!pip install --upgrade openai | |
import openai | |
API_KEY = YOUR_API_KEY #Replace with your Own API Key | |
openai.api_key = API_KEY | |
# Create the chat completion request | |
messages = [] |
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
#install packages | |
!pip install openai | |
import os | |
import openai | |
#openai.organization = "YOUR_ORG_ID" #Not required for a personal use Open AI account | |
API_KEY = "YOUR_API_KEY" | |
openai.api_key = API_KEY |
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
service: streamlit-test-app | |
runtime: custom | |
env: flex | |
manual_scaling: | |
instances: 1 | |
resources: | |
cpu: 1 | |
memory_gb: 0.5 | |
disk_size_gb: 10 |
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
#Base Image to use | |
FROM python:3.7.9-slim | |
#Expose port 8080 | |
EXPOSE 8080 | |
#Optional - install git to fetch packages directly from github | |
RUN apt-get update && apt-get install -y git | |
#Copy Requirements.txt file into app directory |
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
pandas==0.25.3 | |
requests==2.24.0 | |
google-api-core==1.21.0 | |
google-api-python-client==1.10.0 | |
google-auth==1.19.2 | |
google-auth-httplib2==0.0.4 | |
google-cloud-core==1.3.0 | |
google-cloud-trace==0.23.0 | |
google-auth-oauthlib==0.4.1 | |
google-cloud==0.34.0 |
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 pandas as pd | |
import yfinance as yf | |
from google.cloud import bigquery | |
def stocks_test(event, context): | |
get_tickers = pd.read_csv("https://raw.githubusercontent.com/datasets/s-and-p-500-companies-financials/master/data/constituents.csv") | |
stock_dat = yf.download(get_tickers.Symbol.head(5).tolist(),period="2d",actions=False,group_by=None) |
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 Packages | |
import pandas as pd | |
import yfinance as yf | |
from google.cloud import bigquery | |
from google.oauth2 import service_account | |
#Authentication | |
key_path = "your_service_token_path.json" ##Replace with path to your service token file | |
credentials = service_account.Credentials.from_service_account_file( |
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
Date | Open | High | Low | Close | Volume | |
---|---|---|---|---|---|---|
03-01-00 | 1469.25 | 1478.0 | 1438.359985 | 1455.219971 | 931800000 | |
04-01-00 | 1455.219971 | 1455.219971 | 1397.430054 | 1399.420044 | 1009000000 | |
05-01-00 | 1399.420044 | 1413.27002 | 1377.680054 | 1402.109985 | 1085500000 | |
06-01-00 | 1402.109985 | 1411.900024 | 1392.099976 | 1403.449951 | 1092300000 | |
07-01-00 | 1403.449951 | 1441.469971 | 1400.72998 | 1441.469971 | 1225200000 |
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 functools import wraps | |
import logging | |
import time | |
logging.basicConfig(filename="log_file.txt",level=logging.INFO) | |
def time_logger(original_function): | |
@wraps(original_function) | |
def wrapper_function(*args,**kwargs): |
NewerOlder