wintergw commited on
Commit
32c5c6f
·
verified ·
1 Parent(s): 4c55e6c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -0
app.py CHANGED
@@ -14,12 +14,26 @@ repo_id="wintergw/assignment_opt_gurobi",
14
  repo_type="space",
15
  cache_dir="private_space_cache"
16
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  # calling the app code
18
  app = hf_hub_download(
19
  repo_id="wintergw/assignment_opt_gurobi",
20
  filename="app.py",
21
  repo_type="space"
22
  )
 
23
  # executing the app file
24
  spec_app = importlib.util.spec_from_file_location("*",app)
25
  app = importlib.util.module_from_spec(spec_app)
 
14
  repo_type="space",
15
  cache_dir="private_space_cache"
16
  )
17
+
18
+
19
+ #if you call functions from another file “importing files as modules”
20
+ functions = hf_hub_download(
21
+ repo_id="wintergw/assignment_opt_gurobi",
22
+ filename="optmodel.py",
23
+ repo_type="space",
24
+ )
25
+ spec = importlib.util.spec_from_file_location("*", functions)
26
+ foo = importlib.util.module_from_spec(spec)
27
+ spec.loader.exec_module(foo)
28
+
29
+
30
  # calling the app code
31
  app = hf_hub_download(
32
  repo_id="wintergw/assignment_opt_gurobi",
33
  filename="app.py",
34
  repo_type="space"
35
  )
36
+
37
  # executing the app file
38
  spec_app = importlib.util.spec_from_file_location("*",app)
39
  app = importlib.util.module_from_spec(spec_app)