nehalelkaref commited on
Commit
9b91aa6
·
1 Parent(s): 30325ed

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -44,19 +44,18 @@ def temp(text):
44
  print('STARTING ..')
45
  # model_path = 'models/span.model'
46
  # model = SpanNet.load_model(model_path)
47
- space_key = os.environ.get('key')
48
- hf_hub_download(repo_id="nehalelkaref/stagedNER", token=space_key,filename='src/network.py', local_dir='src')
49
- hf_hub_download(repo_id="nehalelkaref/stagedNER", token=space_key,filename='src/utils.py', local_dir='src2')
50
-
51
- # hf_hub_download(repo_id="nehalelkaref/stagedNER", token=space_key,filename='src/utils.py')
52
-
53
- from src.network import SpanNet
54
- from src2.utils import *
55
-
56
- # gr.load(name="nehalelkaref/flat-arabic-entity-classification", hf_token=space_key, src='spaces')
57
- iface = gr.Interface(fn=temp, inputs="text", outputs="text", batch=False)
58
- # iface = gr.Interface(fn=predict_label, inputs="text", outputs="text",auth=True)
59
- iface.launch(share=True, blocked_paths=['models'])
60
-
61
- iface.launch(show_api=False)
62
 
 
44
  print('STARTING ..')
45
  # model_path = 'models/span.model'
46
  # model = SpanNet.load_model(model_path)
47
+ if __name__ == '__main__':
48
+ space_key = os.environ.get('key')
49
+ filenames = ['network.py', 'layers.py', 'utils.py', 'representation.py']
50
+ for file in filenames:
51
+ hf_hub_download('nehalelkaref/stagedNER',
52
+ filename=file,
53
+ local_dir='src',
54
+ token=space_key)
55
+
56
+ from src.network import SpanNet
57
+ # iface = gr.Interface(fn=temp, inputs="text", outputs="text", batch=False)
58
+ iface = gr.Interface(fn=predict_label, inputs="text", outputs="text",auth=True)
59
+ iface.launch(share=True, blocked_paths=['models'])
60
+ iface.launch(show_api=False)
 
61