# [BEGIN OF pluto_happy] # [BEGIN OF pluto_happy] # required pip install import pynvml # for GPU info ## standard libs, no need to install import numpy import PIL import pandas import matplotlib import torch # standard libs (system) import json import time import os import random import re import sys import psutil import socket import importlib.metadata import types import cpuinfo import pathlib import subprocess # define class Pluto_Happy class Pluto_Happy(object): """ The Pluto projects starts with fun AI hackings and become a part of my first book "Data Augmentation with Python" with Packt Publishing. In particular, Pluto_Happy is a clean and lite kernel of a simple class, and using @add_module decoractor to add in specific methods to be a new class, such as Pluto_HFace with a lot more function on HuggingFace, LLM and Transformers. Args: name (str): the display name, e.g. "Hanna the seeker" Returns: (object): the class instance. """ # initialize the object def __init__(self, name="Pluto",*args, **kwargs): super(Pluto_Happy, self).__init__(*args, **kwargs) self.author = "Duc Haba" self.name = name self._ph() self._pp("Hello from class", str(self.__class__) + " Class: " + str(self.__class__.__name__)) self._pp("Code name", self.name) self._pp("Author is", self.author) self._ph() # # define class var for stable division self.fname_requirements = './pluto_happy/requirements.txt' # self.color_primary = '#2780e3' #blue self.color_secondary = '#373a3c' #dark gray self.color_success = '#3fb618' #green self.color_info = '#9954bb' #purple self.color_warning = '#ff7518' #orange self.color_danger = '#ff0039' #red self.color_mid_gray = '#495057' self._xkeyfile = '.xoxo' return # # pretty print output name-value line def _pp(self, a, b,is_print=True): """ Pretty print output name-value line Args: a (str) : b (str) : is_print (bool): whether to print the header or footer lines to console or return a str. Returns: y : None or output as (str) """ # print("%34s : %s" % (str(a), str(b))) x = f'{"%34s" % str(a)} : {str(b)}' y = None if (is_print): print(x) else: y = x return y # # pretty print the header or footer lines def _ph(self,is_print=True): """ Pretty prints the header or footer lines. Args: is_print (bool): whether to print the header or footer lines to console or return a str. Return: y : None or output as (str) """ x = f'{"-"*34} : {"-"*34}' y = None if (is_print): print(x) else: y = x return y # # Define a function to display available CPU and RAM def fetch_info_system(self, is_print=False): """ Fetches system information, such as CPU usage and memory usage. Args: None. Returns: s: (str) A string containing the system information. """ s='' # Get CPU usage as a percentage cpu_usage = psutil.cpu_percent() # Get available memory in bytes mem = psutil.virtual_memory() # Convert bytes to gigabytes mem_total_gb = mem.total / (1024 ** 3) mem_available_gb = mem.available / (1024 ** 3) mem_used_gb = mem.used / (1024 ** 3) # # print it nicely # save the results s += f"Total memory: {mem_total_gb:.2f} GB\n" s += f"Available memory: {mem_available_gb:.2f} GB\n" # print(f"Used memory: {mem_used_gb:.2f} GB") s += f"Memory usage: {mem_used_gb/mem_total_gb:.2f}%\n" try: cpu_info = cpuinfo.get_cpu_info() s += f'CPU type: {cpu_info["brand_raw"]}, arch: {cpu_info["arch"]}\n' s += f'Number of CPU cores: {cpu_info["count"]}\n' s += f"CPU usage: {cpu_usage}%\n" s += f'Python version: {cpu_info["python_version"]}' if (is_print is True): self._ph() self._pp("System", "Info") self._ph() self._pp("Total Memory", f"{mem_total_gb:.2f} GB") self._pp("Available Memory", f"{mem_available_gb:.2f} GB") self._pp("Memory Usage", f"{mem_used_gb/mem_total_gb:.2f}%") self._pp("CPU Type", f'{cpu_info["brand_raw"]}, arch: {cpu_info["arch"]}') self._pp("CPU Cores Count", f'{cpu_info["count"]}') self._pp("CPU Usage", f"{cpu_usage}%") self._pp("Python Version", f'{cpu_info["python_version"]}') except Exception as e: s += f'CPU type: Not accessible, Error: {e}' if (is_print is True): self._ph() self._pp("CPU", f"*Warning* No CPU Access: {e}") return s # # fetch GPU RAM info def fetch_info_gpu(self, is_print=False): """ Function to fetch GPU RAM info Args: None. Returns: s: (str) GPU RAM info in human readable format. """ s='' mtotal = 0 mfree = 0 try: nvml_handle = pynvml.nvmlInit() devices = pynvml.nvmlDeviceGetCount() for i in range(devices): device = pynvml.nvmlDeviceGetHandleByIndex(i) memory_info = pynvml.nvmlDeviceGetMemoryInfo(device) mtotal += memory_info.total mfree += memory_info.free mtotal = mtotal / 1024**3 mfree = mfree / 1024**3 # print(f"GPU {i}: Total Memory: {memory_info.total/1024**3} GB, Free Memory: {memory_info.free/1024**3} GB") s += f'GPU type: {torch.cuda.get_device_name(0)}\n' s += f'GPU ready staus: {torch.cuda.is_available()}\n' s += f'Number of GPUs: {devices}\n' s += f'Total Memory: {mtotal:.2f} GB\n' s += f'Free Memory: {mfree:.2f} GB\n' s += f'GPU allocated RAM: {round(torch.cuda.memory_allocated(0)/1024**3,2)} GB\n' s += f'GPU reserved RAM {round(torch.cuda.memory_reserved(0)/1024**3,2)} GB\n' if (is_print is True): self._ph() self._pp("GPU", "Info") self._ph() self._pp("GPU Type", f'{torch.cuda.get_device_name(0)}') self._pp("GPU Ready Status", f'{torch.cuda.is_available()}') self._pp("GPU Count", f'{devices}') self._pp("GPU Total Memory", f'{mtotal:.2f} GB') self._pp("GPU Free Memory", f'{mfree:.2f} GB') self._pp("GPU allocated RAM", f'{round(torch.cuda.memory_allocated(0)/1024**3,2)} GB') self._pp("GPU reserved RAM", f'{round(torch.cuda.memory_reserved(0)/1024**3,2)} GB') except Exception as e: s += f'**Warning, No GPU: {e}' if (is_print is True): self._ph() self._pp("GPU", f"*Warning* No GPU: {e}") return s # # fetch info about host ip def fetch_info_host_ip(self, is_print=True): """ Function to fetch current host name and ip address Args: None. Returns: s: (str) host name and ip info in human readable format. """ s='' try: hostname = socket.gethostname() ip_address = socket.gethostbyname(hostname) s += f"Hostname: {hostname}\n" s += f"IP Address: {ip_address}\n" if (is_print is True): self._ph() self._pp('Host and Notebook', 'Info') self._ph() self._pp('Host Name', f"{hostname}") self._pp("IP Address", f"{ip_address}") try: from jupyter_server import serverapp self._pp("Jupyter Server", f'{serverapp.__version__}') except ImportError: self._pp("Jupyter Server", "Not accessible") try: import notebook self._pp("Jupyter Notebook", f'{notebook.__version__}') except ImportError: self._pp("Jupyter Notebook ", "Not accessible") except Exception as e: s += f"**Warning, No hostname: {e}" if (is_print is True): self._ph() self._pp('Host Name and Notebook', 'Not accessible') return s # # # fetch import libraries def _fetch_lib_import(self): """ This function fetches all the imported libraries that are installed. Args: None Returns: x (list): list of strings containing the name of the imported libraries. """ x = [] for name, val in globals().items(): if isinstance(val, types.ModuleType): x.append(val.__name__) x.sort() return x # # fetch lib version def _fetch_lib_version(self,lib_name): """ This function fetches the version of the imported libraries. Args: lib_name (list): list of strings containing the name of the imported libraries. Returns: val (list): list of strings containing the version of the imported libraries. """ val = [] for x in lib_name: try: y = importlib.metadata.version(x) val.append(f'{x}=={y}') except Exception as e: val.append(f'|{x}==unknown_*or_system') val.sort() return val # # fetch the lib name and version def fetch_info_lib_import(self): """ This function fetches all the imported libraries name and version that are installed. Args: None Returns: x (list): list of strings containing the name and version of the imported libraries. """ x = self._fetch_lib_version(self._fetch_lib_import()) return x # # write a file to local or cloud diskspace def write_file(self,fname, in_data): """ Write a file to local or cloud diskspace or append to it if it already exists. Args: fname (str): The name of the file to write. in_data (list): The This is a utility function that writes a file to disk. The file name and text to write are passed in as arguments. The file is created, the text is written to it, and then the file is closed. Args: fname (str): The name of the file to write. in_data (list): The text to write to the file. Returns: None """ if os.path.isfile(fname): f = open(fname, "a") else: f = open(fname, "w") f.writelines("\n".join(in_data)) f.close() return # def fetch_installed_libraries(self): """ Retrieves and prints the names and versions of Python libraries installed by the user, excluding the standard libraries. Args: ----- None Returns: -------- dictionary: (dict) A dictionary where keys are the names of the libraries and values are their respective versions. Examples: --------- libraries = get_installed_libraries() for name, version in libraries.items(): print(f"{name}: {version}") """ # List of standard libraries (this may not be exhaustive and might need updates based on the Python version) # Run pip freeze command to get list of installed packages with their versions result = subprocess.run(['pip', 'freeze'], stdout=subprocess.PIPE) # Decode result and split by lines packages = result.stdout.decode('utf-8').splitlines() # Split each line by '==' to separate package names and versions installed_libraries = {} for package in packages: try: name, version = package.split('==') installed_libraries[name] = version except Exception as e: #print(f'{package}: Error: {e}') pass return installed_libraries # # def fetch_match_file_dict(self, file_path, reference_dict): """ Reads a file from the disk, creates an array with each line as an item, and checks if each line exists as a key in the provided dictionary. If it exists, the associated value from the dictionary is also returned. Parameters: ----------- file_path: str Path to the file to be read. reference_dict: dict Dictionary against which the file content (each line) will be checked. Returns: -------- dict: A dictionary where keys are the lines from the file and values are either the associated values from the reference dictionary or None if the key doesn't exist in the dictionary. Raises: ------- FileNotFoundError: If the provided file path does not exist. """ if not os.path.exists(file_path): raise FileNotFoundError(f"The file at {file_path} does not exist.") with open(file_path, 'r') as file: lines = file.readlines() # Check if each line (stripped of whitespace and newline characters) exists in the reference dictionary. # If it exists, fetch its value. Otherwise, set the value to None. results = {line.strip(): reference_dict.get(line.strip().replace('_', '-'), None) for line in lines} return results # print fech_info about myself def print_info_self(self): """ Prints information about the model/myself. Args: None Returns: None """ self._ph() self._pp("Hello, I am", self.name) self._pp("I will display", "Python, Jupyter, and system info.") self._pp("Note", "For doc type: help(pluto) ...or help(your_object_name)") self._pp("Let Rock and Roll", "¯\_(ツ)_/¯") # system x = self.fetch_info_system(is_print=True) # print(x) # self._ph() # gpu # self._pp('GPU', 'Info') x = self.fetch_info_gpu(is_print=True) # print(x) self._ph() # lib used self._pp('Installed lib from', self.fname_requirements) self._ph() x = self.fetch_match_file_dict(self.fname_requirements, self.fetch_installed_libraries()) for item, value in x.items(): self._pp(f'{item} version', value) # self._ph() self._pp('Standard lib from', 'System') self._ph() self._pp('matplotlib version', matplotlib.__version__) self._pp('numpy version', numpy.__version__) self._pp('pandas version',pandas.__version__) self._pp('PIL version', PIL.__version__) self._pp('torch version', torch.__version__) # self.print_ml_libraries() # host ip x = self.fetch_info_host_ip() # print(x) self._ph() # return # def print_ml_libraries(self): """ Checks for the presence of Gradio, fastai, huggingface_hub, and transformers libraries. Prints a message indicating whether each library is found or not. If a library is not found, it prints an informative message specifying the missing library. """ self._ph() self._pp("ML Lib", "Info") try: import fastai self._pp("fastai", f"{fastai.__version__}") except ImportError: self._pp("fastai", "*Warning* library not found.") # try: import transformers self._pp("transformers", f"{transformers.__version__}") except ImportError: self._pp("transformers", "*Warning* library not found.") # try: import diffusers self._pp("diffusers", f"{diffusers.__version__}") except ImportError: self._pp("diffusers", "*Warning* library not found.") # try: import gradio self._pp("gradio", f"{gradio.__version__}") except ImportError: self._pp("Gradio", "*Warning* library not found.") try: import huggingface_hub self._pp("HuggingFace Hub", f"{huggingface_hub.__version__}") except ImportError: self._pp("huggingface_hub", "*Warning* library not found.") return # # add module/method # import functools def add_method(cls): def decorator(func): @functools.wraps(func) def wrapper(*args, **kwargs): return func(*args, **kwargs) setattr(cls, func.__name__, wrapper) return func # returning func means func can still be used normally return decorator # # [END OF pluto_happy] # # # ----------[END OF CODE]---------- # %%write -a app.py # prompt: create the new class foxy from Pluto_FastAI # wake up foxy foxy = Pluto_Happy('Foxy, the seeker of truth.') # %%write -a app.py # check out my environments foxy.fname_requirements = './requirements.txt' foxy.print_info_self() # %%write -a app.py # prompt: find a 8 length hash number for a string import hashlib import fastai import gradio def generate_hash(text, max_length=8): """Generates an x-length hash for a given string.""" hash_object = hashlib.md5(text.encode()) hash_hex = hash_object.hexdigest() return hash_hex[:max_length] # # Read the file content # file_content = os.environ['huggingface_key'] # # Generate the 8-length hash # hash_value = generate_hash(file_content) # print(f"The 8-length hash for the file is: {hash_value}") # %%write -a app.py # prompt: manual def is_system_verified(): if (generate_hash(os.environ['huggingface_key']) == '15d797fe'): return (True) else: return (False) # %%write -a app.py # prompt: using fast.ai to load image learner from file butterfly_learner_1703921531_loss_0.061586.pkl # from fastai.learner import load_learner fname = "./butterfly_learner_1722973740.pkl" foxy.learner = fastai.learner.load_learner(fname) # %%write -a app.py import datetime foxy.print_learner_meta_info(foxy.learner) # %%write -a app.py # prompt: combine the above code cells in the "Predict using download images" into a function with documentation. @add_method(Pluto_FastAI) def predict_butterfly(self, img_pil, return_top=3): """ Predict a butterfly image from a list of downloaded images. Args: img_pil: (PIL image) the image to be predict. return_top: (int) the maximum number of perdiction to return. the default is 3. Returns: (list) An array of the prediction (dictionary): 1. classification: (str) the classification prediction 2. accuracy score: (float) the accuracy value of the prediction 3. index: (int) the index of the prediction array 4. pre_arr: (list) the the prediction array 5. file_name: (str) the full-path file name of the image. """ names = [] values = [] # predict image a1,b1,c1 = self.learner.predict(img_pil) # prompt: covert c1 to a list predict_list = c1.tolist() #print(predict_list) # prompt: print the top 3 largest number and index of the predict_list top_x = sorted(range(len(predict_list)), key=lambda k: predict_list[k], reverse=True)[:return_top] #print(top_3) # prompt: show the name in the foxy.vocab using the top_3 as index for idx in top_x: # print(f"name: {foxy.learner.dls.vocab[idx]}, value: {predict_list[idx]}") names.append(foxy.learner.dls.vocab[idx]) values.append(predict_list[idx]) # return names, values # %%write -a app.py # prompt: (Gemini and codey) # prompt: use matplotlib to draw a donut graph taking a list as name and list of value as input # prompt: add value to the label in the draw_donut_chart function # prompt: replace the white center of the draw_donut_chart function with an image # prompt: add text line to matplotlib plot bottom left position # prompt: change the draw_donut_graph function to use matplotlib.pyplot.subplots import matplotlib @add_method(Pluto_FastAI) def draw_donut_chart(self, names, values, img_center=None, title="Donut Chart", figsize=(12, 6), is_show_plot=False): """ Creates a donut chart using Matplotlib, with 4 distinct colors for up to 4 items. Args: names (list): A list of names for the slices of the donut chart (max 4). values (list): A list of numerical values corresponding to the slices. img_center: (PIL or None) the center image or white blank image. title (str, optional): The title of the chart. Defaults to "Donut Chart". figsize (tuple, optional): The size of the figure in inches. Defaults to (8, 6). """ total = sum(values) values = [value / total * 100 for value in values] fig, ax = matplotlib.pyplot.subplots(figsize=figsize) # #FF6F61 (coral), #6B5B95 (purple), #88B04B (green), #F7CAC9 (pink) colors = ['#257180', '#F2E5BF', '#FD8B51', self.color_secondary] # Define 4 distinct colors # colors = [self.color_primary, self.color_success, self.color_info, self.color_secondary] wedges, texts = ax.pie(values, labels=names, wedgeprops=dict(width=0.6), colors=colors[:len(names)]) # Use the first 4 colors legend_title = [f"{name} ({value:.2f}%)" for name, value in zip(names, values)] ax.legend(wedges, legend_title, loc='best') # was loc="upper right" # Add an image to the center of the donut chart # image_path = "/content/butterfly_img/Monarch460CL.jpg" # img = matplotlib.image.imread(image_path) fig = matplotlib.pyplot.gcf() if img_center is None: center_circle = matplotlib.pyplot.Circle((0, 0), 0.4, fc='white', ec='#333333') ax.add_artist(center_circle) else: # img = PIL.Image.open(img_center_path) ax.imshow(img_center, extent=(-0.5, 0.5, -0.5, 0.5)) t = f"{title}:\n{names[0]}, {round(values[0], 2)}% certainty" ax.set_title(t, fontsize=16) ax.set_axis_off() # copyw = f"*{self.author}, [AI] {self.name} (GNU 3.0) 2024" ax.text(x=0.05, y=0.05, s=copyw, ha='left', va='bottom', fontsize=7.0, transform=ax.transAxes) # fig.tight_layout() if (is_show_plot is True): fig.show() print("show me") # plt.show() return fig # %%write -a app.py # manual # define all components use in Gradio xtitle = """ 🦋 Welcome: Butterfly CNN Image Classification App ### Identify 75 Butterfly Species From Photo. >**Requirement Statement:** (From the client) We aim to boost butterfly numbers by creating and maintaining suitable habitats, promoting biodiversity, and implementing conservation measures that protect them from threats such as habitat loss, climate change, and pesticides. > >**Problem Facing:** Butterfly populations are decreasing due to habitat loss, climate change, and pesticides. This issue endangers their diversity and risks essential pollination services, impacting food production and natural environments. We need the **butterfly population count** from around the world to assess the damage. > > This real-world CNN app is from the ["AI Solution Architect," by ELVTR and Duc Haba](https://elvtr.com/course/ai-solution-architect?utm_source=instructor&utm_campaign=AISA&utm_content=linkedin). --- ### 🌴 Helpful Instruction: 1. Take a picture or upload a picture. 2. Click the "Submit" button. 3. View the result on the Donut plot. 4. (Optional) Rate the correctness of the identification. """ xdescription = """ --- ### 🌴 Author Note: - The final UI is a sophisticated iOS, Android, and web app developed by the UI team. It may or may not include the donut graph, but they all utilize the same REST input-output JSON API. - *I hope you enjoy this as much as I enjoyed making it.* - **For Fun:** Upload your face picture and see what kind of butterfly you are. --- """ xallow_flagging = "manual" xflagging_options = ["Good", "Bad"] xarticle = """ --- ### 🌻 About: - Develop by Duc Haba (human) and GenAI partners (2024). - AI Codey (for help in coding) - AI GPT-4o (for help in coding) - AI Copilot (for help in coding) - Python Jupyter Notebook on Google Colab Pro. - Python 3.10 - 8 CPU Cores (Intel Xeon) - 60 GB RAM - 1 GPU (Tesla T4) - 15 GB GPU RAM - 254 GB Disk Space - Primary Lib: - Fastai (2.7.17) - Standard Lib: - PyTorch - Gradio - PIL - Matplotlib - Numpy - Pandas - Dataset (labled butterfly images) - Kaggle website - The University of Florida's McGuire Center for Lepidoptera and Biodiversity (United States) - Deployment Model and Hardware: - Butterfly CNN model (inference engine) - 2 CPU Cores (Intel Xeon) - 16 GB RAM - No GPU - 16 GB Disk Space - Virtual container (for scaleability in server-cluster) - No Data and no other ML or LLM - Own 100% Intellectual Property --- ### 🤔 Accuracy and Benchmark **Task:** Indentify 75 type of butterfly species from user taking photo with their iPhone. - **94.1% Accurate**: This Butterfly CNN Image Classification developed by Duc Haba and GenAI friends (Deep Learning, CNN) - **Average 87.5% Accurate**: Lepidopterist (human) - **Less than 50% Accurate**: Generative AI, like Genini or Claude 3.5 (AI) (NOTE: Lepidopterist and GenAI estimate are from online sources and GenAI.) --- ### 🦋 KPIs (Key Performance Indicator by Client) 1. **AI-Powered Identification:** The app leverages an advanced CNN model to achieve identification accuracy on par with or surpassing that of expert lepidopterists. It quickly and precisely recognizes butterfly species from user-uploaded images, making it an invaluable tool for butterfly enthusiasts, citizen scientists, and researchers. - Complied. Detail on seperate document. 2. **Accessible API for Integration:** We'll expose an API to integrate the AI with mobile and web apps. It will encourage open-source developers to build hooks into existing or new apps. - Complied. Detail on seperate document. 3. **Universal Access:** The Butterfly app is for everyone, from citizens to experts. We want to create a community that cares about conservation. - Complied. Detail on seperate document. 4. **Shared Database for Research:** Our solution includes a shared database that will hold all collected data. It will be a valuable resource for researchers studying butterfly populations, their distribution, and habitat changes. The database will consolidate real-world data to support scientific research and comprehensive conservation planning. - Complied. Detail on seperate document. 5. **Budget and Schedule:** *Withheld.* - Complied ...mostly :-) --- ### 🤖 The First Law of AI Collaboration: - This CNN Image Classification app development is in compliance with [The First Law of AI Collaboration](https://www.linkedin.com/pulse/first-law-ai-collaboration-duc-haba-hcqkc/) --- ### 🌟 "AI Solution Architect" Course by ELVTR >Welcome to the fascinating world of AI and Convolutional Neural Network (CNN) Image Classification. This CNN model is a part of one of three hands-on application. In our journey together, we will explore the [AI Solution Architect](https://elvtr.com/course/ai-solution-architect?utm_source=instructor&utm_campaign=AISA&utm_content=linkedin) course, meticulously crafted by ELVTR in collaboration with Duc Haba. This course is intended to serve as your gateway into the dynamic and constantly evolving field of AI Solution Architect, providing you with a comprehensive understanding of its complexities and applications. >An AI Solution Architect (AISA) is a mastermind who possesses a deep understanding of the complex technicalities of AI and knows how to creatively integrate them into real-world solutions. They bridge the gap between theoretical AI models and practical, effective applications. AISA works as a strategist to design AI systems that align with business objectives and technical requirements. They delve into algorithms, data structures, and computational theories to translate them into tangible, impactful AI solutions that have the potential to revolutionize industries. > 🍎 [Sign up for the course today](https://elvtr.com/course/ai-solution-architect?utm_source=instructor&utm_campaign=AISA&utm_content=linkedin), and I will see you in class. - An article about the Butterfly CNN Image Classification will be coming soon. --- ### 🙈 Legal: - The intent is to share with Duc's friends and students in the AI Solution Architect course by ELVTR, but for those with nefarious intent, this Butterfly CNN Image Classification is governed by the GNU 3.0 License: https://www.gnu.org/licenses/gpl-3.0.en.html - Author: Copyright (C), 2024 **[Duc Haba](https://linkedin.com/in/duchaba)** --- """ # xinputs = ["image"] xinputs = [gradio.Image(type="pil")] xoutputs = ["plot"] # %%write -a app.py # prompt: write a python code using gradio for simple hello world app # prompt: show all the possible parameters from gradio Interface function # manual: edit the rest def say_butterfly_name(img): # check for access if(is_system_verified() is False): fname = "ezirohtuanU metsyS"[::-1] names = [fname] values= [1.0] return names, values # names, values = foxy.predict_butterfly(img) # add in the other names.append("All Others") values.append(1-sum(values)) # # val.append(item) xcanvas = foxy.draw_donut_chart(names, values, img_center=img, title="Top 3 (out of 75) Butterfly CNN Prediction", is_show_plot=False, figsize=(9,9)) return xcanvas # # # theme, "base, default, glass, soft, monochrome" app = gradio.Interface(fn=say_butterfly_name, inputs=xinputs, outputs=xoutputs, live=False, allow_duplication=False, theme="soft", title=xtitle, description=xdescription, article=xarticle, allow_flagging=xallow_flagging, flagging_options=xflagging_options) # inline = True width = "80%" height = "80%" # 1200 app.launch() # app.launch(debug=True)