chansung commited on
Commit
1fefbde
·
1 Parent(s): 68b6dc7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -1,3 +1,4 @@
 
1
  import tarfile
2
  import gradio as gr
3
  from huggingface_hub import hf_hub_download
@@ -6,13 +7,15 @@ from tensorflow.keras.applications import resnet50
6
 
7
  def load_model(tar_file: str='outputs/model.tar.gz'):
8
  tar_file = tarfile.open(tar_file)
9
- tar_file.extractall()
10
  tar_file.close()
11
 
12
  model_path = 'model'
13
  return keras.models.load_model(model_path)
14
 
15
  hf_hub_download(repo_id='chansung/test_img_clf-model', filename='outputs/model.tar.gz')
 
 
16
  model = load_model()
17
  labels = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
18
 
 
1
+ from os import walk
2
  import tarfile
3
  import gradio as gr
4
  from huggingface_hub import hf_hub_download
 
7
 
8
  def load_model(tar_file: str='outputs/model.tar.gz'):
9
  tar_file = tarfile.open(tar_file)
10
+ tar_file.extractall('.')
11
  tar_file.close()
12
 
13
  model_path = 'model'
14
  return keras.models.load_model(model_path)
15
 
16
  hf_hub_download(repo_id='chansung/test_img_clf-model', filename='outputs/model.tar.gz')
17
+ filenames = next(walk(mypath), (None, None, []))[2] # [] if no file
18
+ print(filenames)
19
  model = load_model()
20
  labels = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
21