diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..13566b81b018ad684f3a35fee301741b2734c8f4
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Editor-based HTTP Client requests
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/HairLossPredictionDemo.iml b/.idea/HairLossPredictionDemo.iml
new file mode 100644
index 0000000000000000000000000000000000000000..33f5c973f83e4b2143c940ea8221e7f4e8fcaa92
--- /dev/null
+++ b/.idea/HairLossPredictionDemo.iml
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5749830a903f29213ce213a7476a2afa04647375
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000000000000000000000000000000000000..105ce2da2d6447d11dfe32bfb846c3d5b199fc99
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000000000000000000000000000000000000..309fdffc67598506a51ecd56da00ed7dc920d9f4
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000000000000000000000000000000000000..ea6d8a447dd5bfffad799368d48726b8891ea36f
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000000000000000000000000000000000000..35eb1ddfbbc029bcab630581847471d7f238ec53
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app.py b/app.py
new file mode 100644
index 0000000000000000000000000000000000000000..0f4d72b3e7c4f7276dcdf9302542141c4e53c580
--- /dev/null
+++ b/app.py
@@ -0,0 +1,81 @@
+import gradio as gr
+import math
+import numpy as np
+import os
+import matplotlib.pyplot as plt
+import random
+from skimage import io as skio
+
+def evolution_plot(current_age):
+ n = 10000
+ maxi = 100
+ x = np.linspace(0, maxi, 10000)
+ max_state = 7
+ final_state = 5
+ y = 1 / (1 + np.exp(-(x / 8) + 5))
+ y = (y - np.min(y)) / (np.max(y - np.min(y))) * (final_state - 1) + 1
+ plt.title("Hair Loss Evolution Prediction")
+ plt.xlabel("Age")
+ plt.ylabel("Nordwood State")
+ plt.ylim(1, max_state)
+ actual = np.where(x < int(current_age))[0][-1]
+ plt.plot(x[:actual], y[:actual])
+ plt.plot(x[actual:], y[actual:], '--')
+ im_save_path = f'tmp/{random.randint(0, 10000)}.png'
+ plt.savefig(im_save_path)
+ plt.clf()
+ plot = skio.imread(im_save_path)
+ return plot
+
+def pad(arr):
+ arr = list(map(str, arr))
+ max_len = 0
+ for i in arr:
+ if len(i)>max_len:
+ max_len = len(i)
+ for i in range(len(arr)):
+ for j in range(max_len-len(arr[i])):
+ arr[i] = arr[i] + " "
+ return arr
+
+def predict(file, age, parent, gp):
+ product = ['Computer', 'Monitor ', 'Laptop ', 'Printer ', 'Tablet ']
+ quantity = pad(np.array([320, 450, 300, 120, 280]) / 500)
+ min_normal = pad(np.array([250, 200, 210, 100, 250]) / 500)
+ max_normal = pad(np.array([400, 300, 450, 150, 300]) / 500)
+ txt = 'Bacteria\t\t\t\t\t\tMin\t\t\tMax\n\n'
+ for i in range(len(product)):
+ txt += product[i]
+ txt += "\t\t\t"
+ txt += quantity[i] + "\t\t" + min_normal[i] + "\t\t" + max_normal[i] + "\t"
+ txt += '\n'
+ txt = str(txt)
+
+ useful_products = ("Hydrating Shampoo : https://www.google.com\n"
+ "Light Hat : https://www.google.com")
+ return skio.imread("results.png"), 'Dermatitis\nDryness\nDandruff', evolution_plot(age), useful_products
+# GUI
+title = 'Hair loss prediction'
+description = 'Metagenomics Scalp Analysis for Hair Loss Prediction'
+# examples = [[f'examples/{name}', 3] for name in sorted(os.listdir('examples'))]
+
+iface = gr.Interface(
+ fn=predict,
+ inputs=[
+ gr.File(type='file', label='Scalp sample'),
+ gr.Textbox(label='Age'),
+ gr.CheckboxGroup(choices=["Yes", "No", "Do not know"], label="Has the father experienced hair loss ?"),
+ gr.CheckboxGroup(choices=["0", "1", "2", "Do not know"], label="How many grand-parents have experienced hair loss ?")
+ ],
+ outputs=[
+ gr.Image(label='Scalp Metagenomics Analysis Results'),
+ gr.Text(label='Current issues :'),
+ gr.Image(label='Future Evolution'),
+ gr.Text(label='Useful Care Products')
+ ],
+ allow_flagging='never',
+ cache_examples=False,
+ title=title,
+ description=description
+)
+iface.launch()
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..fd49f2938390e3f467fb2274b2bbe624c0f36e9c
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,4 @@
+gradio
+numpy
+matplotlib
+scikit-image
\ No newline at end of file
diff --git a/results.png b/results.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab4ee089f751a28e1ad59e942c8d12e0b1ddbe09
Binary files /dev/null and b/results.png differ
diff --git a/tmp/124.png b/tmp/124.png
new file mode 100644
index 0000000000000000000000000000000000000000..0bc68a982d5267759f87b6995678b271110892a7
Binary files /dev/null and b/tmp/124.png differ
diff --git a/tmp/1293.png b/tmp/1293.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/1293.png differ
diff --git a/tmp/1532.png b/tmp/1532.png
new file mode 100644
index 0000000000000000000000000000000000000000..eec0deb3ba976e718b3e040208f9e4f44cd8fd40
Binary files /dev/null and b/tmp/1532.png differ
diff --git a/tmp/1638.png b/tmp/1638.png
new file mode 100644
index 0000000000000000000000000000000000000000..3fbb465628d4f8a87aa3252a6a0ff665c3c7332d
Binary files /dev/null and b/tmp/1638.png differ
diff --git a/tmp/1742.png b/tmp/1742.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0a6c4de2b94f8dd3ca8f540c3eb10d59f4f9148
Binary files /dev/null and b/tmp/1742.png differ
diff --git a/tmp/1770.png b/tmp/1770.png
new file mode 100644
index 0000000000000000000000000000000000000000..e107617b34ed8aacb5f213cbd5902e2cae266aa9
Binary files /dev/null and b/tmp/1770.png differ
diff --git a/tmp/1896.png b/tmp/1896.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/1896.png differ
diff --git a/tmp/2003.png b/tmp/2003.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/2003.png differ
diff --git a/tmp/2390.png b/tmp/2390.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/2390.png differ
diff --git a/tmp/252.png b/tmp/252.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/252.png differ
diff --git a/tmp/2640.png b/tmp/2640.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/2640.png differ
diff --git a/tmp/2755.png b/tmp/2755.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/2755.png differ
diff --git a/tmp/2786.png b/tmp/2786.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0a6c4de2b94f8dd3ca8f540c3eb10d59f4f9148
Binary files /dev/null and b/tmp/2786.png differ
diff --git a/tmp/2945.png b/tmp/2945.png
new file mode 100644
index 0000000000000000000000000000000000000000..5112a3a6e2268ea059ac8231a53772565c8b3a7f
Binary files /dev/null and b/tmp/2945.png differ
diff --git a/tmp/337.png b/tmp/337.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/337.png differ
diff --git a/tmp/3394.png b/tmp/3394.png
new file mode 100644
index 0000000000000000000000000000000000000000..7d342284d539e35bd70ec2568b2b99c0370f542c
Binary files /dev/null and b/tmp/3394.png differ
diff --git a/tmp/3676.png b/tmp/3676.png
new file mode 100644
index 0000000000000000000000000000000000000000..6eff8a21eb09ac350355ba69cf0c15f21248991f
Binary files /dev/null and b/tmp/3676.png differ
diff --git a/tmp/3725.png b/tmp/3725.png
new file mode 100644
index 0000000000000000000000000000000000000000..c5928c6e90e7e62b3ab4423ef556cfcc62543bd7
Binary files /dev/null and b/tmp/3725.png differ
diff --git a/tmp/3743.png b/tmp/3743.png
new file mode 100644
index 0000000000000000000000000000000000000000..c5928c6e90e7e62b3ab4423ef556cfcc62543bd7
Binary files /dev/null and b/tmp/3743.png differ
diff --git a/tmp/4124.png b/tmp/4124.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0a6c4de2b94f8dd3ca8f540c3eb10d59f4f9148
Binary files /dev/null and b/tmp/4124.png differ
diff --git a/tmp/4181.png b/tmp/4181.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/4181.png differ
diff --git a/tmp/4412.png b/tmp/4412.png
new file mode 100644
index 0000000000000000000000000000000000000000..3fbb465628d4f8a87aa3252a6a0ff665c3c7332d
Binary files /dev/null and b/tmp/4412.png differ
diff --git a/tmp/4514.png b/tmp/4514.png
new file mode 100644
index 0000000000000000000000000000000000000000..7d342284d539e35bd70ec2568b2b99c0370f542c
Binary files /dev/null and b/tmp/4514.png differ
diff --git a/tmp/4531.png b/tmp/4531.png
new file mode 100644
index 0000000000000000000000000000000000000000..7d342284d539e35bd70ec2568b2b99c0370f542c
Binary files /dev/null and b/tmp/4531.png differ
diff --git a/tmp/4672.png b/tmp/4672.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/4672.png differ
diff --git a/tmp/468.png b/tmp/468.png
new file mode 100644
index 0000000000000000000000000000000000000000..e48b81e37204ead845e301c6ca059b7751c755cd
Binary files /dev/null and b/tmp/468.png differ
diff --git a/tmp/4851.png b/tmp/4851.png
new file mode 100644
index 0000000000000000000000000000000000000000..ab40590db95fa28749fec3cd3a255511c53d0b1b
Binary files /dev/null and b/tmp/4851.png differ
diff --git a/tmp/4986.png b/tmp/4986.png
new file mode 100644
index 0000000000000000000000000000000000000000..6eff8a21eb09ac350355ba69cf0c15f21248991f
Binary files /dev/null and b/tmp/4986.png differ
diff --git a/tmp/5650.png b/tmp/5650.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0a6c4de2b94f8dd3ca8f540c3eb10d59f4f9148
Binary files /dev/null and b/tmp/5650.png differ
diff --git a/tmp/599.png b/tmp/599.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/599.png differ
diff --git a/tmp/6030.png b/tmp/6030.png
new file mode 100644
index 0000000000000000000000000000000000000000..3ba2933b6faf20b46cff70d830eee620b3f6d86a
Binary files /dev/null and b/tmp/6030.png differ
diff --git a/tmp/6060.png b/tmp/6060.png
new file mode 100644
index 0000000000000000000000000000000000000000..3fbb465628d4f8a87aa3252a6a0ff665c3c7332d
Binary files /dev/null and b/tmp/6060.png differ
diff --git a/tmp/6173.png b/tmp/6173.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/6173.png differ
diff --git a/tmp/6176.png b/tmp/6176.png
new file mode 100644
index 0000000000000000000000000000000000000000..c5928c6e90e7e62b3ab4423ef556cfcc62543bd7
Binary files /dev/null and b/tmp/6176.png differ
diff --git a/tmp/6729.png b/tmp/6729.png
new file mode 100644
index 0000000000000000000000000000000000000000..e107617b34ed8aacb5f213cbd5902e2cae266aa9
Binary files /dev/null and b/tmp/6729.png differ
diff --git a/tmp/7318.png b/tmp/7318.png
new file mode 100644
index 0000000000000000000000000000000000000000..7d342284d539e35bd70ec2568b2b99c0370f542c
Binary files /dev/null and b/tmp/7318.png differ
diff --git a/tmp/746.png b/tmp/746.png
new file mode 100644
index 0000000000000000000000000000000000000000..7647f7520ec69b40575d613d825da3897ac35a91
Binary files /dev/null and b/tmp/746.png differ
diff --git a/tmp/7759.png b/tmp/7759.png
new file mode 100644
index 0000000000000000000000000000000000000000..c0a6c4de2b94f8dd3ca8f540c3eb10d59f4f9148
Binary files /dev/null and b/tmp/7759.png differ
diff --git a/tmp/7808.png b/tmp/7808.png
new file mode 100644
index 0000000000000000000000000000000000000000..eec0deb3ba976e718b3e040208f9e4f44cd8fd40
Binary files /dev/null and b/tmp/7808.png differ
diff --git a/tmp/7996.png b/tmp/7996.png
new file mode 100644
index 0000000000000000000000000000000000000000..6eff8a21eb09ac350355ba69cf0c15f21248991f
Binary files /dev/null and b/tmp/7996.png differ
diff --git a/tmp/8362.png b/tmp/8362.png
new file mode 100644
index 0000000000000000000000000000000000000000..b7285c75c33837cea1abfac5dc32c3be363b87cd
Binary files /dev/null and b/tmp/8362.png differ
diff --git a/tmp/874.png b/tmp/874.png
new file mode 100644
index 0000000000000000000000000000000000000000..3fbb465628d4f8a87aa3252a6a0ff665c3c7332d
Binary files /dev/null and b/tmp/874.png differ
diff --git a/tmp/9029.png b/tmp/9029.png
new file mode 100644
index 0000000000000000000000000000000000000000..bf1ccb59707850506a0671a56dbb7618136be2e9
Binary files /dev/null and b/tmp/9029.png differ
diff --git a/tmp/9250.png b/tmp/9250.png
new file mode 100644
index 0000000000000000000000000000000000000000..7d342284d539e35bd70ec2568b2b99c0370f542c
Binary files /dev/null and b/tmp/9250.png differ
diff --git a/tmp/9270.png b/tmp/9270.png
new file mode 100644
index 0000000000000000000000000000000000000000..49d31db2009ad49881004e3d1b7c6f80f0c800b9
Binary files /dev/null and b/tmp/9270.png differ
diff --git a/tmp/93.png b/tmp/93.png
new file mode 100644
index 0000000000000000000000000000000000000000..3948f61cbee7a1f0e3799934a99f6c120307e59b
Binary files /dev/null and b/tmp/93.png differ
diff --git a/tmp/932.png b/tmp/932.png
new file mode 100644
index 0000000000000000000000000000000000000000..6d60bb9f3bedb3573df218cd30aff2bdc1b070c8
Binary files /dev/null and b/tmp/932.png differ
diff --git a/tmp/9346.png b/tmp/9346.png
new file mode 100644
index 0000000000000000000000000000000000000000..6eff8a21eb09ac350355ba69cf0c15f21248991f
Binary files /dev/null and b/tmp/9346.png differ
diff --git a/tmp/9755.png b/tmp/9755.png
new file mode 100644
index 0000000000000000000000000000000000000000..eec0deb3ba976e718b3e040208f9e4f44cd8fd40
Binary files /dev/null and b/tmp/9755.png differ