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 streamlit as st | |
if 'count' not in st.session_state: | |
st.session_state.count = 0 | |
if 'quotes' not in st.session_state: | |
st.session_state.quotes = [ | |
"Life is what happens when you're busy making other plans. — John Lennon", | |
"Get busy living or get busy dying. — Stephen King", | |
"You only live once, but if you do it right, once is enough. — Mae West", |
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
const OPENAI_API_KEY = ""; // <- PASTE YOUR SECRET KEY HERE | |
const OPENAI_API_URL = "https://api.openai.com/v1/completions"; | |
/** | |
* Submits a prompt to GPT-3 and returns the completion | |
* | |
* @param {string} prompt Prompt to submit to GPT-3 | |
* @param {float} temperature Model temperature (0-1) | |
* @param {string} model Model name (e.g. text-davinci-002) |
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
df = pd.read_csv("reuters-allcats.csv") | |
csv = df.to_csv(index=False) | |
b64 = base64.b64encode(csv.encode()).decode() | |
href = f'<a href="data:file/csv;base64,{b64}" download="myfilename.csv">Try a sample first</a>' | |
st.markdown("👆 Upload a .csv file. " + href, unsafe_allow_html=True) | |
st.stop() |
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
gd = GridOptionsBuilder.from_dataframe(df) | |
# Adds pagination | |
gd.configure_pagination(enabled=True) | |
# Adds editable cells | |
gd.configure_default_column(editable=True, groupable=True) | |
# Enables multi-select in the dataframe | |
gd.configure_selection(selection_mode="multiple", use_checkbox=True) | |
gridoptions = gd.build() | |
grid_table = AgGrid( | |
df, |
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
# The code below is for the title and logo. | |
st.set_page_config( | |
layout=layout, page_title="Dataframe with editable cells", page_icon="💾" | |
) |
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 get_search_console_data(webproperty): | |
if webproperty is not None: | |
# query = webproperty.query.range(start="today", days=days).dimension("query") | |
report = ( | |
webproperty.query.search_type(search_type) | |
.range("today", days=timescale) | |
.dimension(dimension) | |
.filter(filter_page_or_query, filter_keyword, filter_type) | |
.filter(filter_page_or_query2, filter_keyword2, filter_type2) | |
.get() |
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 streamlit as st | |
st.header('test') | |
faqs = [ | |
{ "question": "Tom", "answer": "10" }, | |
{ "question": "Mark", "answer": "5" }, | |
{ "question": "Pam", "answer": "7" }, | |
{ "question": "Dick", "answer": "12" } |
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 zipfile import ZipFile | |
from io import BytesIO | |
zipObj = ZipFile("sample.zip", "w") | |
# Add multiple files to the zip | |
zipObj.write("checkpoint") | |
zipObj.write("model_hyperparameters.json") | |
# close the Zip File | |
zipObj.close() |
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
function getSummary(text){ | |
payload = `text=${text}`; | |
payload = encodeURI(payload); | |
console.log(payload); | |
var url = "https://us-central1-hamlet-title-descr-generator.cloudfunctions.net/t5_post"; | |
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
function ConnectButton(){ | |
console.log("Connect pushed"); | |
document.querySelector("#top-toolbar > colab-connect-button").shadowRoot.querySelector("#connect").click() | |
} | |
setInterval(ConnectButton,60000); |
NewerOlder