James Frecheville commited on
Commit
1055c12
·
1 Parent(s): f73c8ab

Fix import paths for utils module

Browse files
Files changed (2) hide show
  1. app.py +15 -3
  2. owl/webapp.py +10 -2
app.py CHANGED
@@ -1,4 +1,16 @@
1
- from owl.webapp import main
 
 
 
2
 
3
- if __name__ == "__main__":
4
- main()
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import sys
3
+ import gradio as gr
4
+ from pathlib import Path
5
 
6
+ # Add the current directory to Python path
7
+ current_dir = Path(__file__).parent.absolute()
8
+ sys.path.append(str(current_dir))
9
+
10
+ from owl.webapp import create_ui
11
+
12
+ # Create the Gradio interface
13
+ demo = create_ui()
14
+
15
+ # For Hugging Face Spaces
16
+ app = demo.launch(server_name="0.0.0.0", server_port=7860)
owl/webapp.py CHANGED
@@ -11,9 +11,17 @@
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
14
- # Import from the correct module path
15
- from utils import run_society
16
  import os
 
 
 
 
 
 
 
 
 
 
17
  import gradio as gr
18
  import time
19
  import json
 
11
  # See the License for the specific language governing permissions and
12
  # limitations under the License.
13
  # ========= Copyright 2023-2024 @ CAMEL-AI.org. All Rights Reserved. =========
 
 
14
  import os
15
+ import sys
16
+ from pathlib import Path
17
+
18
+ # Add the parent directory to Python path
19
+ current_dir = Path(__file__).parent.absolute()
20
+ parent_dir = current_dir.parent
21
+ if str(parent_dir) not in sys.path:
22
+ sys.path.append(str(parent_dir))
23
+
24
+ from utils import run_society
25
  import gradio as gr
26
  import time
27
  import json