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
st.title("NOAA Weather API Interface") | |
st.write("This Daisi, powered by the `noaa-sdk` Python package, allows for an interaction with the NOAA API for pulling weather forecast data.") | |
with st.sidebar: | |
cc = st.text_input("Country Code", value="US") | |
pc = st.text_input("Postal Code", value="77001") | |
wx_keys, wx_dat = available_wx_data(cc, pc) | |
vars = st.multiselect("Weather Metrics", options=wx_keys, default=["temperature", "dewpoint"]) |
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 available_wx_data(country_code, postal_code): | |
res = n.get_observations(postal_code, country_code) | |
return sorted(list(list(res)[0].keys())), res | |
def forecast(country_code, postal_code, vars, dat=None): | |
if not dat: | |
dat = n.get_forecasts(postal_code, country_code, type='forecastGridData') | |
return {k:v for k, v in dat.items() if k in vars} |
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 pydaisi as pyd | |
twitter_sentiment = pyd.Daisi("erichare/Twitter Sentiment") | |
google_spreadsheets = pyd.Daisi("erichare/Google Spreadsheets") | |
result = twitter_sentiment.get_twitter_sentiment("Pizza", count=10, tweets=None) | |
with open("service-account-file.json", "r") as my_f: | |
print(google_spreadsheets.store_in_gs(result, "[email protected]", my_f.read(), title="Pizza Dat", append = True).value) |
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 pydaisi as pyd | |
import pandas as pd | |
google_spreadsheets = pyd.Daisi("erichare/Google Spreadsheets") | |
df = pd.read_csv("https://gist.githubusercontent.com/netj/8836201/raw/6f9306ad21398ea43cba4f7d537619d0e07d5ae3/iris.csv") | |
email = "<your_email_here>" | |
with open("service_account.json") as my_f: | |
service_account = my_f.read() |
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 pydaisi as pyd | |
twitter_sentiment = pyd.Daisi("erichare/Twitter Sentiment") | |
result = twitter_sentiment.get_twitter_sentiment("Python", count=50).value | |
result |
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 tweepy | |
import pandas as pd | |
# Add Twitter API key and secret | |
consumer_key = "<redacted>" | |
consumer_secret = "<redacted>" | |
# Handling authentication with Twitter | |
auth = tweepy.AppAuthHandler(consumer_key, consumer_secret) | |
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 tensorflow as tf | |
from transformers import pipeline | |
sentiment_task = pipeline("sentiment-analysis", model="sentiment-roberta-large-english", tokenizer="sentiment-roberta-large-english") | |
def get_sentiment(text): | |
''' | |
Use a Sentiment Detection model on the given text | |
... | |
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 pydaisi as pyd | |
tw_daisi = pyd.Daisi("erichare/Twitter Search") | |
sa_daisi = pyd.Daisi("erichare/Sentiment Analysis") | |
result = tw_daisi.fetch_tweets("Pepperoni Pizza", count=10).value | |
sentiment = sa_daisi.get_sentiment([x for x in result["text"].tolist()]).value | |
result["label"] = [x["label"] for x in sentiment] | |
result["score"] = [x["score"] for x in sentiment] |
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 pydaisi as pyd | |
sentiment_analysis = pyd.Daisi("erichare/Sentiment Analysis") | |
sentiment_analysis.get_sentiment("I am so happy").value | |
sentiment_analysis.get_sentiment(["I am so happy", "Actually, I'm not sure", "I'm pretty upset"]).value |
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 pydaisi as pyd | |
twitter_search = pyd.Daisi("erichare/Twitter Search") | |
tweets = twitter_search.fetch_tweets(query="Pepperoni Pizza", count=10).value | |
tweets |
NewerOlder