imagensAletorias
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import numpy as np
|
|
| 3 |
import keras
|
| 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 = """
|
|
@@ -54,7 +55,11 @@ def inicializa_modelo():
|
|
| 54 |
model = from_pretrained_keras(file)
|
| 55 |
print('modelo carregado.')
|
| 56 |
return model
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
if 'model' not in st.session_state:
|
| 60 |
with st.spinner('carregando o modelo...'):
|
|
@@ -72,6 +77,13 @@ with st.container():
|
|
| 72 |
name_image = "doencas_pulmonares.jpg"
|
| 73 |
imagem = image.load_img(name_image)
|
| 74 |
col1.image(imagem, width=700)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
st.write("")
|
| 77 |
st.write("")
|
|
|
|
| 3 |
import keras
|
| 4 |
from keras.preprocessing import image
|
| 5 |
from huggingface_hub import from_pretrained_keras
|
| 6 |
+
import random
|
| 7 |
|
| 8 |
# Remove whitespace from the top of the page
|
| 9 |
reduce_header_height_style = """
|
|
|
|
| 55 |
model = from_pretrained_keras(file)
|
| 56 |
print('modelo carregado.')
|
| 57 |
return model
|
| 58 |
+
|
| 59 |
+
def escolher_imagem():
|
| 60 |
+
imagens = ['CHNCXR_0342_1.png', 'CHNCXR_0022_0.png', 'CHNCXR_0006_0.png', 'CHNCXR_0004_0.png', 'CHNCXR_0338_1.png', 'CHNCXR_0340_1.png', 'CHNCXR_0020_0.png', 'CHNCXR_0019_0.png', 'CHNCXR_0024_0.png', 'CHNCXR_0344_1.png', 'CHNCXR_0002_0.png', 'CHNCXR_0327_1.png', 'CHNCXR_0346_1.png', 'CHNCXR_0005_0.png', 'CHNCXR_0021_0.png', 'CHNCXR_0341_1.png', 'CHNCXR_0339_1.png', 'CHNCXR_0023_0.png', 'CHNCXR_0343_1.png', 'CHNCXR_0007_0.png', 'CHNCXR_0003_0.png', 'CHNCXR_0347_1.png', 'CHNCXR_0345_1.png', 'CHNCXR_0025_0.png', 'CHNCXR_0018_0.png', 'CHNCXR_0001_0.png', 'CHNCXR_0328_1.png', 'CHNCXR_0350_1.png', 'CHNCXR_0014_0.png', 'CHNCXR_0331_1.png', 'CHNCXR_0349_1.png', 'CHNCXR_0016_0.png', 'CHNCXR_0333_1.png', 'CHNCXR_0337_1.png', 'CHNCXR_0012_0.png', 'CHNCXR_0335_1.png', 'CHNCXR_0010_0.png', 'CHNCXR_0009_0.png', 'CHNCXR_0332_1.png', 'CHNCXR_0017_0.png', 'CHNCXR_0351_1.png', 'CHNCXR_0329_1.png', 'CHNCXR_0348_1.png', 'CHNCXR_0330_1.png', 'CHNCXR_0015_0.png', 'CHNCXR_0011_0.png', 'CHNCXR_0334_1.png', 'CHNCXR_0008_0.png', 'CHNCXR_0013_0.png', 'CHNCXR_0336_1.png']
|
| 61 |
+
imagem = random.sample(imagens, k=1)[0]
|
| 62 |
+
return imagem
|
| 63 |
|
| 64 |
if 'model' not in st.session_state:
|
| 65 |
with st.spinner('carregando o modelo...'):
|
|
|
|
| 77 |
name_image = "doencas_pulmonares.jpg"
|
| 78 |
imagem = image.load_img(name_image)
|
| 79 |
col1.image(imagem, width=700)
|
| 80 |
+
|
| 81 |
+
if st.button('Raios-X Diversos'):
|
| 82 |
+
nome_imagem = escolher_imagem()
|
| 83 |
+
col1.image(imagem)
|
| 84 |
+
col1.header(predict_image(file_upload))
|
| 85 |
+
|
| 86 |
+
|
| 87 |
|
| 88 |
st.write("")
|
| 89 |
st.write("")
|