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 main(): | |
URL = "https://webscraper.io/test-sites/e-commerce/allinone" | |
driver = get_driver() | |
driver.get(URL) | |
driver.implicitly_wait(10) | |
products = driver.find_elements(By.XPATH, '//div[@class="col-sm-4 col-lg-4 col-md-4"]') | |
for product in products: | |
product_title = product.find_element(By.XPATH, './/a[@class="title"]').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
def get_driver(): | |
time.sleep(3) | |
chrome_options = webdriver.ChromeOptions() | |
chrome_options.add_argument("--no-sandbox") | |
chrome_options.add_argument("--headless") | |
driver = webdriver.Remote( | |
command_executor='http://headless_chrome:3000/webdriver', | |
options=chrome_options, | |
) |
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 flask import Flask, requests | |
from ml_model import Model | |
model = Model() | |
app = Flask(__name__) | |
@app.route('/predict', methods=['POST']) | |
def predict(): | |
recieved_params = requests.get_json(force=True) | |
output = model.predict(recieved_params) |
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 add(first_num: int, second_num: int) -> int: | |
return first_num + second_num | |
add("a", "b") | |
>>ab |
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
>>> var = "Hello" | |
>>> type(var) | |
<class 'str'> | |
>>> var = 28.1 | |
>>> type(var) | |
<class 'float'> |
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 typing import Union | |
def add(first_value: int, second_value: int) -> Union(int, bool): | |
if first_value == 0: | |
return False | |
return first_value + second_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
from typing import Tuple | |
def add(first_value: int, second_value: int) -> Tuple[int, int]: | |
print(f"Sum = {first_value+second_value}") | |
return first_value, second_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
def add(first_value: int, second_value: int) -> int: | |
return first_value + second 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
def add(first_value: int, second_value: int): | |
pass |
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 requests | |
f = {'file': open('img.jpg', 'rb').read()} | |
URL = 'http://127.0.0.1:5000/predict' | |
result = requests.post(URL, files=f) | |
print(result.text) |
NewerOlder