valencar commited on
Commit
2e54c82
·
1 Parent(s): 49c6af6
Files changed (1) hide show
  1. app.py +18 -11
app.py CHANGED
@@ -57,26 +57,33 @@ def predict_image(name_image):
57
  # path_in_repo="README.md",
58
  # repo_id="username/test-dataset",
59
  # repo_type="dataset",
 
 
 
 
 
 
 
 
 
60
 
61
- from huggingface_hub import HfApi
62
- api = HfApi()
63
- api.upload_file(
64
- path_or_fileobj="./" + name_image,
65
- path_in_repo=name_image,
66
- repo_id="valencar/modelo_raios_x",
67
- repo_type="dataset",
68
- )
69
 
70
  fname = path.abspath(path.join(path.dirname(__file__), name_image))
71
- st.write(fname)
72
 
73
- img = img_orig = image.load_img(fname, target_size = (IMAGE_HEIGHT, IMAGE_WIDTH))
 
 
 
 
 
 
 
74
  img = image.img_to_array(img)
75
  img = np.expand_dims(img, axis = 0)
76
  img = img/255.0
77
 
78
 
79
- col1.image(fname, width=450)
80
 
81
  pred = st.session_state.model.predict(img)
82
  classe = np.argmax(pred)
 
57
  # path_in_repo="README.md",
58
  # repo_id="username/test-dataset",
59
  # repo_type="dataset",
60
+ #
61
+ # from huggingface_hub import HfApi
62
+ # api = HfApi()
63
+ # api.upload_file(
64
+ # path_or_fileobj="./" + name_image,
65
+ # path_in_repo=name_image,
66
+ # repo_id="valencar/modelo_raios_x",
67
+ # repo_type="dataset",
68
+ # )
69
 
 
 
 
 
 
 
 
 
70
 
71
  fname = path.abspath(path.join(path.dirname(__file__), name_image))
 
72
 
73
+
74
+ import sys
75
+ from pathlib import Path
76
+ path_file = Path(sys.path[0])
77
+ print(path_file)
78
+ col1.header(path_file)
79
+
80
+ img = img_orig = image.load_img(path_file + '/' + name_image, target_size = (IMAGE_HEIGHT, IMAGE_WIDTH))
81
  img = image.img_to_array(img)
82
  img = np.expand_dims(img, axis = 0)
83
  img = img/255.0
84
 
85
 
86
+ col1.image(path_file + '/' + name_image, width=450)
87
 
88
  pred = st.session_state.model.predict(img)
89
  classe = np.argmax(pred)