Arts-of-coding commited on
Commit
56dc3ca
1 Parent(s): ed963d2

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +62 -62
main.py CHANGED
@@ -1,63 +1,63 @@
1
- import uvicorn
2
- from fastapi import FastAPI
3
- from fastapi.middleware.wsgi import WSGIMiddleware
4
- from dash_plotly_QC_scRNA import app as dashboard1
5
- #from app2 import app as dashboard2
6
-
7
- #########################################################
8
- import dash
9
- from dash import dcc, html, Output, Input
10
- import plotly.express as px
11
- import dash_callback_chain
12
- import yaml
13
- import polars as pl
14
- pl.enable_string_cache(False)
15
-
16
- # Set custom resolution for plots:
17
- config_fig = {
18
- 'toImageButtonOptions': {
19
- 'format': 'svg',
20
- 'filename': 'custom_image',
21
- 'height': 600,
22
- 'width': 700,
23
- 'scale': 1,
24
- }
25
- }
26
-
27
- config_path = "./app/azure/config.yaml"
28
-
29
- # Add the read-in data from the yaml file
30
- def read_config(filename):
31
- with open(filename, 'r') as yaml_file:
32
- config = yaml.safe_load(yaml_file)
33
- return config
34
-
35
- config = read_config(config_path)
36
- path_parquet = config.get("path_parquet")
37
- conditions = config.get("conditions")
38
- col_features = config.get("col_features")
39
- col_counts = config.get("col_counts")
40
- col_mt = config.get("col_mt")
41
-
42
- # Import the data from one .parquet file
43
- df = pl.read_parquet(path_parquet)
44
- #df = df.rename({"__index_level_0__": "Unnamed: 0"})
45
-
46
- # Setup the app
47
- external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
48
-
49
- ######################################################################
50
- # Define the FastAPI server
51
- app = FastAPI()
52
- # Mount the Dash app as a sub-application in the FastAPI server
53
- app.mount("/dashboard1", WSGIMiddleware(dashboard1.server))
54
- #app.mount("/dashboard2", WSGIMiddleware(dashboard2.server))
55
-
56
- # Define the main API endpoint
57
- @app.get("/")
58
- def index():
59
- return "Hello"
60
-
61
- # Start the FastAPI server
62
- if __name__ == "__main__":
63
  uvicorn.run(app, host="0.0.0.0")
 
1
+ import uvicorn
2
+ from fastapi import FastAPI
3
+ from fastapi.middleware.wsgi import WSGIMiddleware
4
+ from dash_plotly_QC_scRNA import app as dashboard1
5
+ #from app2 import app as dashboard2
6
+
7
+ #########################################################
8
+ import dash
9
+ from dash import dcc, html, Output, Input
10
+ import plotly.express as px
11
+ import dash_callback_chain
12
+ import yaml
13
+ import polars as pl
14
+ pl.enable_string_cache(False)
15
+
16
+ # Set custom resolution for plots:
17
+ config_fig = {
18
+ 'toImageButtonOptions': {
19
+ 'format': 'svg',
20
+ 'filename': 'custom_image',
21
+ 'height': 600,
22
+ 'width': 700,
23
+ 'scale': 1,
24
+ }
25
+ }
26
+
27
+ config_path = "./azure/config.yaml"
28
+
29
+ # Add the read-in data from the yaml file
30
+ def read_config(filename):
31
+ with open(filename, 'r') as yaml_file:
32
+ config = yaml.safe_load(yaml_file)
33
+ return config
34
+
35
+ config = read_config(config_path)
36
+ path_parquet = config.get("path_parquet")
37
+ conditions = config.get("conditions")
38
+ col_features = config.get("col_features")
39
+ col_counts = config.get("col_counts")
40
+ col_mt = config.get("col_mt")
41
+
42
+ # Import the data from one .parquet file
43
+ df = pl.read_parquet(path_parquet)
44
+ #df = df.rename({"__index_level_0__": "Unnamed: 0"})
45
+
46
+ # Setup the app
47
+ external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
48
+
49
+ ######################################################################
50
+ # Define the FastAPI server
51
+ app = FastAPI()
52
+ # Mount the Dash app as a sub-application in the FastAPI server
53
+ app.mount("/dashboard1", WSGIMiddleware(dashboard1.server))
54
+ #app.mount("/dashboard2", WSGIMiddleware(dashboard2.server))
55
+
56
+ # Define the main API endpoint
57
+ @app.get("/")
58
+ def index():
59
+ return "Hello"
60
+
61
+ # Start the FastAPI server
62
+ if __name__ == "__main__":
63
  uvicorn.run(app, host="0.0.0.0")