Spaces:
Runtime error
Runtime error
File size: 912 Bytes
e38a9d9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
import sys
import os
# Add the virtual environment's site-packages to sys.path
# Replace 'pythonX.Y' with your Python version, e.g., 'python3.8'
venv_path = os.path.join(os.path.dirname(__file__), 'venv', 'lib', 'site-packages')
sys.path.append(venv_path)
# Ensure the directory structure is recognized as a package
# You can verify by listing the contents of the directory
print("sys.path:", sys.path)
print("Contents of venv_path:", os.listdir(venv_path))
# Now import the TestsetGenerator
try:
from ragas.testset.generator import TestsetGenerator
print("Successfully imported TestsetGenerator.")
except ImportError as e:
print("ImportError:", e)
# Use the imported function or class
try:
generator = TestsetGenerator()
print("Successfully created a TestsetGenerator instance.")
except Exception as e:
print("Error creating TestsetGenerator instance:", e)
|