Spaces:
Paused
Paused
import sys | |
from pathlib import Path | |
# Add the project root to the Python path | |
sys.path.insert(0, str(Path(__file__).resolve().parent)) | |
import asyncio | |
from app import generate_monster | |
from core.ai_pipeline import MonsterGenerationPipeline | |
class MockOAuthProfile: | |
def __init__(self, username): | |
self.username = username | |
async def main(): | |
# Create a mock OAuth profile | |
mock_profile = MockOAuthProfile(username="test_user") | |
# Call the generate_monster function with a text prompt | |
# This will trigger the 3D generation pipeline | |
image_path, model_path, stats, dialogue, message = await asyncio.to_thread( | |
generate_monster, | |
oauth_profile=mock_profile, | |
text_input="a cute, fluffy, blue monster" | |
) | |
# Print the results | |
print(f"Message: {message}") | |
print(f"Image Path: {image_path}") | |
print(f"3D Model Path: {model_path}") | |
print(f"Stats: {stats}") | |
print(f"Dialogue: {dialogue}") | |
if __name__ == "__main__": | |
# The generate_monster function is a regular function, but since it can be run in a separate thread by Gradio, | |
# it's better to run it in an asyncio event loop to be safe. | |
asyncio.run(main()) | |