Spaces:
Paused
Paused
File size: 1,189 Bytes
05ce3e0 |
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 28 29 30 31 32 33 34 35 36 37 38 |
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())
|