This Flask application provides an API to generate 3D models from text prompts, convert them to specific formats, and serve them for download. It integrates with external APIs for model generation and supports additional functionality like file conversion and zipping.
- Generate 3D Models: Generate 3D models based on user-provided text prompts.
- File Conversion: Convert generated files from FBX to OBJ format using PyMeshLab.
- File Management: Zip generated files for easy download.
- Download Endpoint: Serve files through an API endpoint.
- Python 3.8+
- pip (Python package manager)
-
Clone the Repository:
git clone <repository-url> cd <repository-folder>
-
Install Dependencies: Install all required libraries using
requirements.txt:pip install -r requirements.txt
-
Setup Output Directory: Ensure an
outputdirectory exists in the project root:mkdir output
Start the Flask server:
python app.pyThe server will be available at http://0.0.0.0:5000.
Endpoint:
POST /generateRequest Body (JSON):
{
"URID": "unique_model_id",
"prompt": "A futuristic spaceship",
"filename": "spaceship_model.zip"
}Response (JSON):
{
"message": "Model generated successfully. Files saved and zipped at ./output/spaceship_model.zip",
"zip_file": "./output/spaceship_model.zip"
}Endpoint:
GET /download/<filename>Example: Download the generated ZIP file:
curl -O http://localhost:5000/download/spaceship_model.zipResponse: The requested file will be downloaded.
.
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── output/ # Directory for generated files
├── README.md # Documentation
- Flask
- requests
- PyMeshLab
Install all dependencies using the provided requirements.txt.
- Ensure your external model generation API is accessible and properly configured.
- Use absolute paths for directory management if running the app in different environments.
- Test endpoints using tools like Postman, cURL, or Unity.
This project is licensed under the MIT License.