import uvicorn from fastapi import FastAPI from fastapi.middleware.wsgi import WSGIMiddleware from dash_plotly_QC_scRNA import app as dashboard1 #from app2 import app as dashboard2 ######################################################### import dash from dash import dcc, html, Output, Input import plotly.express as px import dash_callback_chain import yaml import polars as pl import os pl.enable_string_cache(False) # Set custom resolution for plots: config_fig = { 'toImageButtonOptions': { 'format': 'svg', 'filename': 'custom_image', 'height': 600, 'width': 700, 'scale': 1, } } from adlfs import AzureBlobFileSystem mountpount=os.environ['AZURE_MOUNT_POINT'], accountkey=os.environ['AZURE_STORAGE_ACCESS_KEY'], accountname=os.environ['AZURE_STORAGE_ACCOUNT'], filepath = 'az://bucket-name/df_test_predicate_pushdown.parquet' storage_options={'account_name': accountname, 'account_key': accountkey,'anon': False} azfs = AzureBlobFileSystem(**storage_options ) df = pl.read_parquet(filepath,storage_options=storage_options) #pq.write_table(polars_dataframe.to_arrow(), 'liu/file_name.parquet', filesystem=abfs) #storage_options = { # "aws_access_key_id": , # "aws_secret_access_key": os.environ['AZURE_STORAGE_ACCESS_KEY'], #} #df = pl.scan_parquet(source, storage_options=storage_options) #config_path = "./azure/data/config.yaml" # Add the read-in data from the yaml file #def read_config(filename): # with open(filename, 'r') as yaml_file: # config = yaml.safe_load(yaml_file) # return config #config = read_config(config_path) #path_parquet = config.get("path_parquet") #conditions = config.get("conditions") #col_features = config.get("col_features") #col_counts = config.get("col_counts") #col_mt = config.get("col_mt") # Import the data from one .parquet file #df = pl.read_parquet(path_parquet) #df = df.rename({"__index_level_0__": "Unnamed: 0"}) # Setup the app external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css'] ###################################################################### # Define the FastAPI server # Mount the Dash app as a sub-application in the FastAPI server #app.mount("/dashboard2", WSGIMiddleware(dashboard2.server)) # Start the FastAPI server if __name__ == "__main__": app = FastAPI() app.mount("/dashboard1", WSGIMiddleware(dashboard1.server)) uvicorn.run(app, host="0.0.0.0")