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 | |
import vertexai | |
from vertexai.preview import rag | |
# Enable detailed logging to see the actual URLs | |
logging.basicConfig(level=logging.DEBUG) | |
logging.getLogger('google.cloud.aiplatform').setLevel(logging.DEBUG) | |
logging.getLogger('urllib3.connectionpool').setLevel(logging.DEBUG) | |
# Your current setup |
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
# flashtext_regex_timing_keyword_extraction.py | |
from flashtext.keyword import KeywordProcessor | |
import random | |
import string | |
import re | |
import time | |
def get_word_of_length(str_length): | |
# generate a random word of given length | |
return ''.join(random.choice(string.ascii_lowercase) for _ in range(str_length)) |
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
age | sex | cp | trestbps | chol | fbs | restecg | thalach | exang | oldpeak | slope | ca | thal | target | age2 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
63 | 1 | 3 | 145 | 233 | 1 | 0 | 150 | 0 | 2.3 | 0 | 0 | 1 | 1 | 0.63 | |
37 | 1 | 2 | 130 | 250 | 0 | 1 | 187 | 0 | 3.5 | 0 | 0 | 2 | 1 | 0.37 | |
41 | 0 | 1 | 130 | 204 | 0 | 0 | 172 | 0 | 1.4 | 2 | 0 | 2 | 1 | 0.41 | |
56 | 1 | 1 | 120 | 236 | 0 | 1 | 178 | 0 | 0.8 | 2 | 0 | 2 | 1 | 0.56 | |
57 | 0 | 0 | 120 | 354 | 0 | 1 | 163 | 1 | 0.6 | 2 | 0 | 2 | 1 | 0.57 | |
57 | 1 | 0 | 140 | 192 | 0 | 1 | 148 | 0 | 0.4 | 1 | 0 | 1 | 1 | 0.57 | |
56 | 0 | 1 | 140 | 294 | 0 | 0 | 153 | 0 | 1.3 | 1 | 0 | 2 | 1 | 0.56 | |
44 | 1 | 1 | 120 | 263 | 0 | 1 | 173 | 0 | 0 | 2 | 0 | 3 | 1 | 0.44 | |
52 | 1 | 2 | 172 | 199 | 1 | 1 | 162 | 0 | 0.5 | 2 | 0 | 3 | 1 | 0.52 |
We can make this file beautiful and searchable if this error is corrected: No commas found in this CSV file in line 0.
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
"age";"job";"marital";"education";"default";"balance";"housing";"loan";"contact";"day";"month";"duration";"campaign";"pdays";"previous";"poutcome";"y" | |
30;"unemployed";"married";"primary";"no";1787;"no";"no";"cellular";19;"oct";79;1;-1;0;"unknown";"no" | |
33;"services";"married";"secondary";"no";4789;"yes";"yes";"cellular";11;"may";220;1;339;4;"failure";"no" | |
35;"management";"single";"tertiary";"no";1350;"yes";"no";"cellular";16;"apr";185;1;330;1;"failure";"no" | |
30;"management";"married";"tertiary";"no";1476;"yes";"yes";"unknown";3;"jun";199;4;-1;0;"unknown";"no" | |
59;"blue-collar";"married";"secondary";"no";0;"yes";"no";"unknown";5;"may";226;1;-1;0;"unknown";"no" | |
35;"management";"single";"tertiary";"no";747;"no";"no";"cellular";23;"feb";141;2;176;3;"failure";"no" | |
36;"self-employed";"married";"tertiary";"no";307;"yes";"no";"cellular";14;"may";341;1;330;2;"other";"no" | |
39;"technician";"married";"secondary";"no";147;"yes";"no";"cellular";6;"may";151;2;-1;0;"unknown";"no" | |
41;"entrepreneur";"married";"tertiary";"no";221;" |
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
ui <- fluidPage( | |
actionButton("minus", "-1"), | |
actionButton("plus", "+1"), | |
br(), | |
textOutput("value") | |
) | |
# The comments below show the equivalent logic using reactiveValues() | |
server <- function(input, output, session) { | |
value <- reactiveVal(0) # rv <- reactiveValues(value = 0) |
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
library(shiny)########################################################################## | |
ui <- fixedPage( | |
h2("Normal example"), | |
uiOutput("moreControls"), | |
uiOutput("moreControls1"), | |
uiOutput("test") | |
) | |
server <- function(input, output, session) { |
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
library (shiny) | |
server <- function(input, output) { | |
rv <- reactiveValues(numFields = 1) | |
# | |
# start with one input box | |
# | |
output$fieldsUI <- renderUI(textInput("textInput1", "Input #1", 67)) | |
# |
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
t = paste0("head(", "mtcars", ")") | |
eval(parse(text = t)) | |
# mpg cyl disp hp drat wt qsec vs am gear carb | |
#Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4 | |
#Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 | |
#Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1 | |
#Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 0 3 1 | |
#Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 | |
#Valiant 18.1 6 225 105 2.76 3.460 20.22 1 0 3 1 |