valencar commited on
Commit
9828ecc
·
1 Parent(s): 86d2da5
Files changed (1) hide show
  1. app.py +2 -27
app.py CHANGED
@@ -4,18 +4,6 @@ import keras
4
  from keras.preprocessing import image
5
  from huggingface_hub import from_pretrained_keras
6
 
7
- #url_image = '' ### './'
8
- #name_image = '/home/user/app/'+ name_image
9
-
10
- #image.load_img(name_image)
11
-
12
- #folder = 'dados_teste_github/'
13
-
14
-
15
- # fs_query_file = "hf://datasets/my-username/my-dataset-repo/data_dir/data.parquet"
16
- # df = duckdb.query(f"SELECT * FROM '{fs_query_file}'"f
17
-
18
-
19
  # Remove whitespace from the top of the page
20
  reduce_header_height_style = """
21
  <style> .stDeployButton {visibility: hidden;} </style>
@@ -23,30 +11,17 @@ reduce_header_height_style = """
23
  """
24
  st.markdown(reduce_header_height_style, unsafe_allow_html=True)
25
 
26
- #def predict_image(name_image):
27
 
28
  def predict_image(file_name):
29
 
30
  IMAGE_HEIGHT, IMAGE_WIDTH = 299, 299
31
  categories = ['Normal', 'Tuberculose']
32
- url_image = './'
33
-
34
- from PIL import Image
35
- #file_name = st.file_uploader("Upload a hot dog candidate image")
36
- # file_name = st.file_uploader("Carregue uma imagem:")
37
- # image_hf = Image.open(file_name)
38
-
39
- # col1.header(file_name)
40
- # col1.image(image_hf, width=450)
41
 
42
  img = img_orig = image.load_img(file_name, target_size = (IMAGE_HEIGHT, IMAGE_WIDTH))
43
  img = image.img_to_array(img)
44
  img = np.expand_dims(img, axis = 0)
45
  img = img/255.0
46
 
47
-
48
-
49
-
50
  pred = st.session_state.model.predict(img)
51
  classe = np.argmax(pred)
52
  nome_classe = categories[classe]
@@ -63,7 +38,7 @@ def predict_image(file_name):
63
 
64
  msg = 'Previsão: ' + classe_prevista + str_prob
65
  #col1.header(msg)
66
- print(mensagem)
67
 
68
  return msg
69
 
@@ -124,7 +99,7 @@ st.write("")
124
 
125
  footer="\
126
  <div > \
127
- <p>Sistema de Apoio ao Diagnóstico de Doenças Pulmonares versão 1.0.1.<br> \
128
  Desenvolvido por Prof. Dr. Vladimir Costa de Alencar e Equipe de Pesquisadores do LANA/UEPB. <br> \
129
  Campina Grande, Paraíba, Brasil, 2024.<br> \
130
  <a href='https://www.valencar.com' target='_blank'>www.valencar.com</a></p>"
 
4
  from keras.preprocessing import image
5
  from huggingface_hub import from_pretrained_keras
6
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  # Remove whitespace from the top of the page
8
  reduce_header_height_style = """
9
  <style> .stDeployButton {visibility: hidden;} </style>
 
11
  """
12
  st.markdown(reduce_header_height_style, unsafe_allow_html=True)
13
 
 
14
 
15
  def predict_image(file_name):
16
 
17
  IMAGE_HEIGHT, IMAGE_WIDTH = 299, 299
18
  categories = ['Normal', 'Tuberculose']
 
 
 
 
 
 
 
 
 
19
 
20
  img = img_orig = image.load_img(file_name, target_size = (IMAGE_HEIGHT, IMAGE_WIDTH))
21
  img = image.img_to_array(img)
22
  img = np.expand_dims(img, axis = 0)
23
  img = img/255.0
24
 
 
 
 
25
  pred = st.session_state.model.predict(img)
26
  classe = np.argmax(pred)
27
  nome_classe = categories[classe]
 
38
 
39
  msg = 'Previsão: ' + classe_prevista + str_prob
40
  #col1.header(msg)
41
+ #print(mensagem)
42
 
43
  return msg
44
 
 
99
 
100
  footer="\
101
  <div > \
102
+ <p>Sistema de Apoio ao Diagnóstico de Doenças Pulmonares versão 1.0.2.<br> \
103
  Desenvolvido por Prof. Dr. Vladimir Costa de Alencar e Equipe de Pesquisadores do LANA/UEPB. <br> \
104
  Campina Grande, Paraíba, Brasil, 2024.<br> \
105
  <a href='https://www.valencar.com' target='_blank'>www.valencar.com</a></p>"