Commit
•
53ee624
1
Parent(s):
24b268e
added himalaya products
Browse files- .ipynb_checkpoints/Face Problems-checkpoint.ipynb +0 -0
- Face Problems.ipynb +99 -1
- app.py +5 -15
- recommendation.xlsx +0 -0
.ipynb_checkpoints/Face Problems-checkpoint.ipynb
ADDED
The diff for this file is too large to render.
See raw diff
|
|
Face Problems.ipynb
CHANGED
@@ -1341,9 +1341,107 @@
|
|
1341 |
},
|
1342 |
{
|
1343 |
"cell_type": "code",
|
1344 |
-
"execution_count":
|
1345 |
"id": "d7b76171",
|
1346 |
"metadata": {},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1347 |
"outputs": [],
|
1348 |
"source": []
|
1349 |
}
|
|
|
1341 |
},
|
1342 |
{
|
1343 |
"cell_type": "code",
|
1344 |
+
"execution_count": 16,
|
1345 |
"id": "d7b76171",
|
1346 |
"metadata": {},
|
1347 |
+
"outputs": [
|
1348 |
+
{
|
1349 |
+
"name": "stderr",
|
1350 |
+
"output_type": "stream",
|
1351 |
+
"text": [
|
1352 |
+
"D:\\Anaconda\\envs\\development\\lib\\site-packages\\gradio\\deprecation.py:40: UserWarning: `enable_queue` is deprecated in `Interface()`, please use it within `launch()` instead.\n",
|
1353 |
+
" warnings.warn(value)\n",
|
1354 |
+
"D:\\Anaconda\\envs\\development\\lib\\site-packages\\gradio\\deprecation.py:43: UserWarning: You have unused kwarg parameters in Blocks, please remove them: {'description': 'A face condition detector trained on the custom dataset with fastai. Created using Gradio and HuggingFace Spaces.', 'examples': [['harmonal_acne.jpg'], ['forehead_wrinkles.jpg'], ['oily_skin.jpg']]}\n",
|
1355 |
+
" warnings.warn(\n",
|
1356 |
+
"D:\\Anaconda\\envs\\development\\lib\\site-packages\\gradio\\inputs.py:256: UserWarning: Usage of gradio.inputs is deprecated, and will not be supported in the future, please import your component from gradio.components\n",
|
1357 |
+
" warnings.warn(\n",
|
1358 |
+
"D:\\Anaconda\\envs\\development\\lib\\site-packages\\gradio\\deprecation.py:40: UserWarning: `optional` parameter is deprecated, and it has no effect\n",
|
1359 |
+
" warnings.warn(value)\n",
|
1360 |
+
"D:\\Anaconda\\envs\\development\\lib\\site-packages\\gradio\\outputs.py:196: UserWarning: Usage of gradio.outputs is deprecated, and will not be supported in the future, please import your components from gradio.components\n",
|
1361 |
+
" warnings.warn(\n",
|
1362 |
+
"D:\\Anaconda\\envs\\development\\lib\\site-packages\\gradio\\deprecation.py:40: UserWarning: The 'type' parameter has been deprecated. Use the Number component instead.\n",
|
1363 |
+
" warnings.warn(value)\n"
|
1364 |
+
]
|
1365 |
+
},
|
1366 |
+
{
|
1367 |
+
"name": "stdout",
|
1368 |
+
"output_type": "stream",
|
1369 |
+
"text": [
|
1370 |
+
"Running on local URL: http://127.0.0.1:7875\n",
|
1371 |
+
"\n",
|
1372 |
+
"To create a public link, set `share=True` in `launch()`.\n"
|
1373 |
+
]
|
1374 |
+
},
|
1375 |
+
{
|
1376 |
+
"data": {
|
1377 |
+
"text/html": [
|
1378 |
+
"<div><iframe src=\"http://127.0.0.1:7875/\" width=\"900\" height=\"500\" allow=\"autoplay; camera; microphone;\" frameborder=\"0\" allowfullscreen></iframe></div>"
|
1379 |
+
],
|
1380 |
+
"text/plain": [
|
1381 |
+
"<IPython.core.display.HTML object>"
|
1382 |
+
]
|
1383 |
+
},
|
1384 |
+
"metadata": {},
|
1385 |
+
"output_type": "display_data"
|
1386 |
+
},
|
1387 |
+
{
|
1388 |
+
"data": {
|
1389 |
+
"text/plain": [
|
1390 |
+
"(<gradio.routes.App at 0x17529404130>, 'http://127.0.0.1:7875/', None)"
|
1391 |
+
]
|
1392 |
+
},
|
1393 |
+
"execution_count": 16,
|
1394 |
+
"metadata": {},
|
1395 |
+
"output_type": "execute_result"
|
1396 |
+
}
|
1397 |
+
],
|
1398 |
+
"source": [
|
1399 |
+
"import gradio as gr\n",
|
1400 |
+
"from fastai.vision.all import *\n",
|
1401 |
+
"import skimage\n",
|
1402 |
+
"import pathlib\n",
|
1403 |
+
"import pandas as pd\n",
|
1404 |
+
"\n",
|
1405 |
+
"plt = platform.system()\n",
|
1406 |
+
"if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath\n",
|
1407 |
+
"title = \"Face condition Analyzer\"\n",
|
1408 |
+
"description = \"A face condition detector trained on the custom dataset with fastai. Created using Gradio and HuggingFace Spaces.\"\n",
|
1409 |
+
"examples = [['harmonal_acne.jpg'],['forehead_wrinkles.jpg'],['oily_skin.jpg']]\n",
|
1410 |
+
"enable_queue=True\n",
|
1411 |
+
"\n",
|
1412 |
+
"with gr.Blocks(title=title,description=description,examples=examples,enable_queue=enable_queue) as demo:\n",
|
1413 |
+
" learn = load_learner('export.pkl')\n",
|
1414 |
+
" labels = learn.dls.vocab\n",
|
1415 |
+
" def predict(img):\n",
|
1416 |
+
" img = PILImage.create(img)\n",
|
1417 |
+
" pred,pred_idx,probs = learn.predict(img)\n",
|
1418 |
+
" return {labels[i]: float(probs[i]) for i in range(len(labels))}\n",
|
1419 |
+
" gr.Markdown(\"# Face Skin Analyzer\")\n",
|
1420 |
+
" gr.Markdown(\"A face condition detector trained on the custom dataset with fastai. Created using Gradio and HuggingFace Spaces. Kindly upload a photo of your face.\")\n",
|
1421 |
+
" with gr.Row():\n",
|
1422 |
+
" inputs = gr.inputs.Image(shape=(512, 512))\n",
|
1423 |
+
" outputs = gr.outputs.Label(num_top_classes=3)\n",
|
1424 |
+
" btn = gr.Button(\"Predict\")\n",
|
1425 |
+
" btn.click(fn=predict, inputs=inputs, outputs=outputs)\n",
|
1426 |
+
" \n",
|
1427 |
+
" df=pd.read_excel(\"recommendation.xlsx\")\n",
|
1428 |
+
" classes = df['class'].unique()\n",
|
1429 |
+
" with gr.Accordion(\"Find your skin condition using above analyzer and see the Recommended solutions\",open=True):\n",
|
1430 |
+
" for c in classes:\n",
|
1431 |
+
" with gr.Accordion(c,open=False):\n",
|
1432 |
+
" df_temp = df[df['class']==c]\n",
|
1433 |
+
" with gr.Row():\n",
|
1434 |
+
" for i,current_row in df_temp.iterrows():\n",
|
1435 |
+
" with gr.Column():\n",
|
1436 |
+
" html_box = gr.HTML(\"<a href='{}'><img src ='{}'></a>\".format(current_row['profit_link'],current_row['product_image'])) \n",
|
1437 |
+
"demo.launch()"
|
1438 |
+
]
|
1439 |
+
},
|
1440 |
+
{
|
1441 |
+
"cell_type": "code",
|
1442 |
+
"execution_count": null,
|
1443 |
+
"id": "e575d70d",
|
1444 |
+
"metadata": {},
|
1445 |
"outputs": [],
|
1446 |
"source": []
|
1447 |
}
|
app.py
CHANGED
@@ -6,22 +6,11 @@ import pandas as pd
|
|
6 |
|
7 |
plt = platform.system()
|
8 |
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
|
9 |
-
|
10 |
-
# learn = load_learner('export.pkl')
|
11 |
-
|
12 |
-
# labels = learn.dls.vocab
|
13 |
-
# def predict(img):
|
14 |
-
# img = PILImage.create(img)
|
15 |
-
# pred,pred_idx,probs = learn.predict(img)
|
16 |
-
# return {labels[i]: float(probs[i]) for i in range(len(labels))}
|
17 |
-
|
18 |
title = "Face condition Analyzer"
|
19 |
description = "A face condition detector trained on the custom dataset with fastai. Created using Gradio and HuggingFace Spaces."
|
20 |
examples = [['harmonal_acne.jpg'],['forehead_wrinkles.jpg'],['oily_skin.jpg']]
|
21 |
enable_queue=True
|
22 |
|
23 |
-
# gr.Interface(fn=predict,inputs=gr.inputs.Image(shape=(512, 512)),outputs=gr.outputs.Label(num_top_classes=3),title=title,
|
24 |
-
# description=description,examples=examples,enable_queue=enable_queue).launch()
|
25 |
with gr.Blocks(title=title,description=description,examples=examples,enable_queue=enable_queue) as demo:
|
26 |
learn = load_learner('export.pkl')
|
27 |
labels = learn.dls.vocab
|
@@ -39,11 +28,12 @@ with gr.Blocks(title=title,description=description,examples=examples,enable_queu
|
|
39 |
|
40 |
df=pd.read_excel("recommendation.xlsx")
|
41 |
classes = df['class'].unique()
|
42 |
-
with gr.Accordion("Find your skin condition using above analyzer and see the Recommended solutions",open=
|
43 |
for c in classes:
|
44 |
with gr.Accordion(c,open=False):
|
45 |
df_temp = df[df['class']==c]
|
46 |
-
|
47 |
-
|
48 |
-
|
|
|
49 |
demo.launch()
|
|
|
6 |
|
7 |
plt = platform.system()
|
8 |
if plt == 'Linux': pathlib.WindowsPath = pathlib.PosixPath
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
title = "Face condition Analyzer"
|
10 |
description = "A face condition detector trained on the custom dataset with fastai. Created using Gradio and HuggingFace Spaces."
|
11 |
examples = [['harmonal_acne.jpg'],['forehead_wrinkles.jpg'],['oily_skin.jpg']]
|
12 |
enable_queue=True
|
13 |
|
|
|
|
|
14 |
with gr.Blocks(title=title,description=description,examples=examples,enable_queue=enable_queue) as demo:
|
15 |
learn = load_learner('export.pkl')
|
16 |
labels = learn.dls.vocab
|
|
|
28 |
|
29 |
df=pd.read_excel("recommendation.xlsx")
|
30 |
classes = df['class'].unique()
|
31 |
+
with gr.Accordion("Find your skin condition using above analyzer and see the Recommended solutions",open=True):
|
32 |
for c in classes:
|
33 |
with gr.Accordion(c,open=False):
|
34 |
df_temp = df[df['class']==c]
|
35 |
+
with gr.Row():
|
36 |
+
for i,current_row in df_temp.iterrows():
|
37 |
+
with gr.Column():
|
38 |
+
html_box = gr.HTML("<a href='{}'><img src ='{}'></a>".format(current_row['profit_link'],current_row['product_image']))
|
39 |
demo.launch()
|
recommendation.xlsx
CHANGED
Binary files a/recommendation.xlsx and b/recommendation.xlsx differ
|
|