Skip to content

Commit

Permalink
headless app for guide in Supervisely developer portal (#1)
Browse files Browse the repository at this point in the history
* readme done

* headless

Co-authored-by: Maxim Kolomeychenko <maxim@supervise.ly>
  • Loading branch information
mkolomeychenko and Maxim Kolomeychenko authored Aug 1, 2022
1 parent 7769a94 commit c6e0400
Show file tree
Hide file tree
Showing 14 changed files with 108 additions and 107 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
/secret_debug.env
.venv
.DS_Store
16 changes: 16 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true,
"env": {
"PYTHONPATH": "${workspaceFolder}:${PYTHONPATH}"
}
}
]
}
18 changes: 18 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"python.defaultInterpreterPath": ".venv/bin/python",
"files.exclude": {
"**/__pycache__": true,
".venv": true
},
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.formatOnType": true,
"[html]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"python.formatting.provider": "black",
"debug.inlineValues": "off",
}
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
# hello-world-app
Supervisely hello world app - use it as a template for your custom appliation or for debug purposes

<div align="center" markdown>
<img src="https://user-images.githubusercontent.com/12828725/182181033-d0d1a690-8388-472e-8862-e0cacbd4f082.png"/>

# Hello World App

<p align="center">
<a href="#Overview">Overview</a> •
<a href="#How-to-use">How To Use</a>
</p>

</div>

# Overview

Explain here what your app does.

# How to use

Step by step guide with examples and demos
24 changes: 8 additions & 16 deletions config.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,11 @@
{
"name": "Hello World App",
"name": "Hello World!",
"type": "app",
"categories": [
"development"
],
"description": "Working demo, use it as a template for your custom apps",
"docker_image": "supervisely/base-py-sdk:6.35.0",
"main_script": "src/my_main_script.py",
"modal_template": "src/modal.html",
"modal_template_state": {
"length": 5
},
"gui_template": "src/gui.html",
"task_location": "application_sessions",
"isolate": true,
"icon": "https://img.icons8.com/fluent/96/000000/source-code.png",
"categories": ["development"],
"description": "Demonstrates how to turn your python script into Supervisely App",
"docker_image": "supervisely/base-py-sdk:6.50.0",
"main_script": "src/main.py",
"task_location": "workspace_tasks",
"icon": "https://user-images.githubusercontent.com/12828725/182186256-5ee663ad-25c7-4a62-9af1-fbfdca715b57.png",
"icon_background": "#FFFFFF"
}
}
19 changes: 19 additions & 0 deletions create_venv.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# learn more in documentation
# Official python docs: https://docs.python.org/3/library/venv.html
# Superviely developer portal: https://developer.supervise.ly/getting-started/installation#venv

if [ -d "venv" ]; then
echo "VENV already exists, will be removed"
rm -rf .venv
fi

echo "VENV will be created" && \
python3 -m venv .venv && \
source .venv/bin/activate && \

echo "Install requirements..." && \
pip3 install -r requirements.txt && \
echo "Requirements have been successfully installed" && \
deactivate
9 changes: 0 additions & 9 deletions debug.env

This file was deleted.

1 change: 1 addition & 0 deletions local.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
context.userLogin="max"
7 changes: 7 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
supervisely==6.50.0

# used to print cool text to stdout
art==5.7

# my favorite code formatter
black==22.6.0
3 changes: 0 additions & 3 deletions secret_debug_example.env

This file was deleted.

18 changes: 0 additions & 18 deletions src/gui.html

This file was deleted.

17 changes: 17 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import os
import supervisely as sly
from dotenv import load_dotenv
from art import tprint

load_dotenv("local.env")


def main():
name = os.environ["context.userLogin"]
print("Hello World!")
print("This app is run by user:")
tprint(name)


if __name__ == "__main__":
main()
6 changes: 0 additions & 6 deletions src/modal.html

This file was deleted.

52 changes: 0 additions & 52 deletions src/my_main_script.py

This file was deleted.

0 comments on commit c6e0400

Please sign in to comment.