09.10.2023 Views

Advanced Data Analytics Using Python_ With Machine Learning, Deep Learning and NLP Examples ( 2023)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 7

Analytics at Scale

if prob > 0.9:

prob = 0.9

if self.big:

high, low, high_big, low_big =

thread.result()

if howbig > 0.6:

high = high_big

low = low_big

else:

high, low = thread.result()

multiplier = low + (high -low)*prob

res = multiplier*res

resp.body = str(res)

#except Exception,e:

# print(str(e))

# resp.status = falcon.HTTP_200

# resp.body = str("0.1")

cors = CORS(allow_all_origins=True,allow_all_

methods=True,allow_all_headers=True)

wsgi_app = api = falcon.API(middleware=[cors.middleware])

f = open('publishers2.list_test')

for line in f:

if "#" not in line:

fields = line.strip().split('\t')

domain = fields[0].strip()

big = (fields[1].strip() == '1')

p = Predictor(domain, big)

url = '/predict/' + domain

api.add_route(url, p)

f.close()

178

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!