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
# Imports | |
# ----------------------------------------------------------- | |
import os | |
import streamlit as st | |
from django.core.wsgi import get_wsgi_application | |
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings") | |
application = get_wsgi_application() |
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
<link rel="stylesheet" href="https://pyscript.net/alpha/pyscript.css" /> | |
<script defer src="https://pyscript.net/alpha/pyscript.js"></script> |
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 check_password(): | |
"""Returns `True` if the user had a correct password.""" | |
def password_entered(): | |
"""Checks whether a password entered by the user is correct.""" | |
user = authenticate( | |
username=st.session_state['username'], | |
password=st.session_state['password'] | |
) | |
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
rank | ensemble_weight | type | cost | duration | |
---|---|---|---|---|---|
1 | 0.540 | random_forest | 0.340 | 2.307 | |
2 | 0.040 | random_forest | 0.399 | 1.863 | |
3 | 0.060 | random_forest | 0.419 | 2.268 | |
4 | 0.020 | lda | 0.427 | 0.685 | |
5 | 0.080 | lda | 0.443 | 0.597 | |
6 | 0.040 | liblinear_svc | 0.443 | 0.692 | |
7 | 0.060 | lda | 0.447 | 0.612 | |
8 | 0.020 | random_forest | 0.458 | 1.556 | |
9 | 0.020 | liblinear_svc | 0.474 | 3.518 |
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
bboxes = [[0, 128, 300, 420], [366.7, 340, 270, 230]] | |
category_ids = [1, 2] | |
transform = A.Compose( | |
[A.HorizontalFlip(p=0.5), A.Rotate()], | |
bbox_params=A.BboxParams(format="coco", label_fields=["category_ids"]), # Configuring pipeline for annotation | |
) | |
# Passing annotation coordinates and categories with the image | |
transformed = transform(image=image, bboxes=bboxes, category_ids=category_ids) |
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 os | |
# testing Fibonacci number function | |
def fib(n: int) -> int: | |
return n if n < 2 else fib(n-1)+fib(n-2) | |
def test_fibonacci(): | |
assert fib(int(os.environ["FIB_INPUT"])) == 55 # It was 54 before |
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 unittest | |
def fib(n: int): | |
return n if n < 2 else fib(n - 1) + fib(n - 2) | |
class TestFibonacciFunction(unittest.TestCase): | |
def test_big_fibonacci(self): | |
self.assertEqual(fib(10), 55) |
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 pipe import chain | |
nested_list = [[1, 2, 3], [4, 5, 6], [7, [8, 9]]] | |
unfolded_list = list(nested_list | |
| chain | |
) | |
print(unfolded_list) |
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
INSTALLED_APPS = [ | |
"django.contrib.admin", | |
"django.contrib.auth", | |
"django.contrib.contenttypes", | |
"django.contrib.sessions", | |
"django.contrib.messages", | |
"django.contrib.staticfiles", | |
# Your app | |
"myawesomeapp", | |
] |
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 django.urls import path | |
from views import sum_odd_numbers | |
urlpatterns = [ | |
path("sum_odd_numbers/<int:n>", sum_odd_numbers), | |
] |