Update app.py
Browse files
app.py
CHANGED
|
@@ -3,18 +3,21 @@ import sys
|
|
| 3 |
import random
|
| 4 |
import gradio as gr
|
| 5 |
from multiprocessing import freeze_support
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 6 |
import importlib
|
| 7 |
import txagent.txagent
|
| 8 |
-
# Fix path to include src directory
|
| 9 |
-
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "src"))
|
| 10 |
importlib.reload(txagent.txagent)
|
| 11 |
from txagent.txagent import TxAgent
|
| 12 |
-
import inspect
|
| 13 |
|
|
|
|
|
|
|
| 14 |
print(">>> TxAgent loaded from:", inspect.getfile(TxAgent))
|
| 15 |
print(">>> TxAgent has run_gradio_chat:", hasattr(TxAgent, "run_gradio_chat"))
|
| 16 |
|
| 17 |
-
|
| 18 |
# === Environment setup ===
|
| 19 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 20 |
os.environ["MKL_THREADING_LAYER"] = "GNU"
|
|
|
|
| 3 |
import random
|
| 4 |
import gradio as gr
|
| 5 |
from multiprocessing import freeze_support
|
| 6 |
+
|
| 7 |
+
# ✅ Fix path first (before importing anything custom)
|
| 8 |
+
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), "src"))
|
| 9 |
+
|
| 10 |
+
# ✅ Now import the correct module
|
| 11 |
import importlib
|
| 12 |
import txagent.txagent
|
|
|
|
|
|
|
| 13 |
importlib.reload(txagent.txagent)
|
| 14 |
from txagent.txagent import TxAgent
|
|
|
|
| 15 |
|
| 16 |
+
# ✅ Confirm
|
| 17 |
+
import inspect
|
| 18 |
print(">>> TxAgent loaded from:", inspect.getfile(TxAgent))
|
| 19 |
print(">>> TxAgent has run_gradio_chat:", hasattr(TxAgent, "run_gradio_chat"))
|
| 20 |
|
|
|
|
| 21 |
# === Environment setup ===
|
| 22 |
current_dir = os.path.dirname(os.path.abspath(__file__))
|
| 23 |
os.environ["MKL_THREADING_LAYER"] = "GNU"
|