Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
intern-william@nodeflux-67 committed Jun 26, 2022
1 parent 0e1151f commit 9e9ae4a
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 21 deletions.
3 changes: 2 additions & 1 deletion app_flask.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ def fiftyone_load():

if __name__ == '__main__':
session = fo.launch_app(dataset, address=config.address, port=config.port['fiftyone'], remote=True)
app.run(host=config.host, port=config.port['flask'])
app.run(host=config.host, port=config.port['flask'])
# app.run(host='0.0.0.0', port='6000')
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
port = {
'flask' : 6000,
'flask' : 6001,
'fiftyone' : 6002,
'dash' : 6001,
'dash' : 6003,
}

host = address = ip = '0.0.0.0'
Expand Down
33 changes: 16 additions & 17 deletions pages/embedding.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,22 @@ def update_figure(uniqueness_slider_range, sqrt_area_slider_range):
dash.Input(component_id='graph', component_property='selectedData')
)
def update(name, input_value):
print(name, input_value)
if input_value is not None:
ids = set()
points = input_value['points']
for point in points:
id = point['customdata'][0]
ids.add(id)
ids = list(ids)
requests.post(
url = f'{config.url}:{config.port["flask"]}/fiftyone/update',
json = {
'name' : name,
'ids' : ids
}
)
return f'Callback: {input_value}'

if input_value is None: return f'No sample selected.'
ids = set()
points = input_value['points']
for point in points:
id = point['customdata'][0]
ids.add(id)
ids = list(ids)
requests.post(
url = f'{config.url}:{config.port["flask"]}/fiftyone/update',
json = {
'name' : name,
'ids' : ids
}
)
return f'Number of images: {len(ids)}'

dash.register_page(__name__, path_template="/embedding/<name>")

def layout(name=None):
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ fiftyone==0.16.5
torch==1.11.0
torchvision==0.12.0
umap-learn==0.5.3
ipywidgetsipywidgets==7.7.1
ipywidgets==7.7.1
pandas==1.4.3
13 changes: 13 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Start the first process
python3 app_flask.py &

# Start the second process
python3 app_dash.py &

# Wait for any process to exit
wait -n

# Exit with status of process that exited first
exit $?

0 comments on commit 9e9ae4a

Please sign in to comment.