dangtiendatdat commited on
Commit
fecc2d4
·
verified ·
1 Parent(s): 9bb6270

Update MeAI_Maincode/skin.py

Browse files
Files changed (1) hide show
  1. MeAI_Maincode/skin.py +6 -3
MeAI_Maincode/skin.py CHANGED
@@ -130,14 +130,16 @@ trans_description = {
130
  "verruca_vulgaris": "Mụn cóc thông thường",
131
  "vitiligo": "Mất màu da"
132
  }
133
- def detect_skin_disease_new(image, key):
134
  try:
135
-
136
  img = Image.fromarray((image).astype('uint8'))
 
137
  img_byte_array = io.BytesIO()
138
  img.save(img_byte_array, format='PNG')
139
  img_byte_array.seek(0)
140
 
 
 
141
  url = "https://detect-skin-disease1.p.rapidapi.com/skin-disease"
142
  files = {"image": ("image.png", img_byte_array, "image/png")}
143
  headers = {
@@ -189,6 +191,7 @@ def detect_skin_disease_new(image, key):
189
 
190
 
191
 
 
192
  def create_skin_tab_new(skinkey="a8108953dbmsh2baabfa3db731fdp14177bjsnfebbe465261d"):
193
  css = """
194
  .textboxskin {
@@ -202,5 +205,5 @@ def create_skin_tab_new(skinkey="a8108953dbmsh2baabfa3db731fdp14177bjsnfebbe4652
202
  inp = gr.Image(type="numpy",height=512, width=512)
203
  out = gr.Label(label="Kết Quả Dự Đoán",elem_classes="textboxskin")
204
  btn = gr.Button("Xử Lý")
205
- btn.click(fn=detect_skin_disease_new, inputs=[inp,keybox], outputs=out)
206
  return demo
 
130
  "verruca_vulgaris": "Mụn cóc thông thường",
131
  "vitiligo": "Mất màu da"
132
  }
133
+ def detect_skin_disease(image, key):
134
  try:
 
135
  img = Image.fromarray((image).astype('uint8'))
136
+ # image = Image.open(image)
137
  img_byte_array = io.BytesIO()
138
  img.save(img_byte_array, format='PNG')
139
  img_byte_array.seek(0)
140
 
141
+
142
+
143
  url = "https://detect-skin-disease1.p.rapidapi.com/skin-disease"
144
  files = {"image": ("image.png", img_byte_array, "image/png")}
145
  headers = {
 
191
 
192
 
193
 
194
+
195
  def create_skin_tab_new(skinkey="a8108953dbmsh2baabfa3db731fdp14177bjsnfebbe465261d"):
196
  css = """
197
  .textboxskin {
 
205
  inp = gr.Image(type="numpy",height=512, width=512)
206
  out = gr.Label(label="Kết Quả Dự Đoán",elem_classes="textboxskin")
207
  btn = gr.Button("Xử Lý")
208
+ btn.click(fn=detect_skin_disease, inputs=[inp,keybox], outputs=out)
209
  return demo