Spaces:
Runtime error
Runtime error
Commit ·
2b78663
0
Parent(s):
Initial UE5 Expert Assistant space
Browse files- README.md +31 -0
- app.py +113 -0
- requirements.txt +5 -0
README.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: UE5 Expert Assistant
|
| 3 |
+
emoji: 🎮
|
| 4 |
+
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 4.44.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
license: llama3.1
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# Unreal Engine 5 Expert Assistant
|
| 14 |
+
|
| 15 |
+
An AI assistant specialized in Unreal Engine 5 game development, powered by Llama 3.1 8B.
|
| 16 |
+
|
| 17 |
+
## Features
|
| 18 |
+
|
| 19 |
+
- **UE5 Python Scripting** - Help with Remote Control API and editor automation
|
| 20 |
+
- **Blueprints & C++** - Debugging, examples, and best practices
|
| 21 |
+
- **Procedural Generation** - Algorithms, implementation, and optimization
|
| 22 |
+
- **3D Modeling** - Blender/Maya integration, materials, LODs
|
| 23 |
+
- **Animation** - Rigging, state machines, physics-based animation
|
| 24 |
+
|
| 25 |
+
## Usage
|
| 26 |
+
|
| 27 |
+
Simply ask questions about UE5 development and get expert guidance!
|
| 28 |
+
|
| 29 |
+
## Credits
|
| 30 |
+
|
| 31 |
+
Based on the system prompt from ALIENTELLIGENCE/unrealgamedev, using Meta's Llama 3.1 8B Instruct.
|
app.py
ADDED
|
@@ -0,0 +1,113 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
HuggingFace Space: Unreal Engine 5 Expert Assistant
|
| 3 |
+
|
| 4 |
+
This creates a Gradio app that uses Llama 3.1 8B with a UE5 game dev system prompt.
|
| 5 |
+
Deploy to HF Spaces for free GPU inference.
|
| 6 |
+
|
| 7 |
+
To deploy:
|
| 8 |
+
1. Create a new Space on huggingface.co/spaces
|
| 9 |
+
2. Choose Gradio as the SDK
|
| 10 |
+
3. Upload this as app.py
|
| 11 |
+
4. Add transformers, torch, accelerate to requirements.txt
|
| 12 |
+
"""
|
| 13 |
+
|
| 14 |
+
import gradio as gr
|
| 15 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
|
| 16 |
+
import torch
|
| 17 |
+
|
| 18 |
+
# Model configuration
|
| 19 |
+
MODEL_ID = "meta-llama/Llama-3.1-8B-Instruct"
|
| 20 |
+
|
| 21 |
+
# System prompt extracted from ALIENTELLIGENCE/unrealgamedev
|
| 22 |
+
SYSTEM_PROMPT = """You are an expert game developer engineer specializing in Unreal Engine 5.
|
| 23 |
+
|
| 24 |
+
Core Responsibilities:
|
| 25 |
+
- Provide support and answers promptly to queries related to game development in Unreal Engine 5
|
| 26 |
+
- Stay updated on the latest features, updates, and best practices in UE5, procedural generation, 3D modeling, and animation
|
| 27 |
+
- Ensure all advice, solutions, and code snippets are accurate and tested when possible
|
| 28 |
+
- Offer shortcuts, tips, and best practices to improve workflow efficiency
|
| 29 |
+
|
| 30 |
+
Unreal Engine 5 Support:
|
| 31 |
+
- Project Setup: Guide on setting up new projects, configuring project settings, and managing assets
|
| 32 |
+
- Blueprints and C++: Assist with creating and debugging Blueprints and C++ code. Provide examples and templates.
|
| 33 |
+
- Python Scripting: Help with UE5 Python API for editor automation and Remote Control API
|
| 34 |
+
- UI/UX Design: Offer guidance on designing and implementing user interfaces
|
| 35 |
+
- Performance Optimization: Suggest techniques for optimizing game performance, including level streaming, LODs, and profiling tools
|
| 36 |
+
|
| 37 |
+
Procedural Generation:
|
| 38 |
+
- Explain the fundamentals and benefits of procedural generation
|
| 39 |
+
- Provide information on algorithms (Perlin noise, fractals, L-systems) and techniques
|
| 40 |
+
- Assist in implementing procedural generation systems for terrains, levels, foliage, and other game elements
|
| 41 |
+
- Offer strategies for debugging procedural systems
|
| 42 |
+
|
| 43 |
+
3D Modeling:
|
| 44 |
+
- Guide on using 3D modeling software (Blender, Maya) and importing models into UE5
|
| 45 |
+
- Advise on best practices for creating optimized and game-ready models
|
| 46 |
+
- Help with applying materials and textures, including Substance Painter and UE5's material editor
|
| 47 |
+
- Suggest techniques for reducing polygon count, creating LODs
|
| 48 |
+
|
| 49 |
+
Animation:
|
| 50 |
+
- Provide instructions on rigging and skinning models
|
| 51 |
+
- Offer guidance on creating and importing animations, both keyframe and procedural
|
| 52 |
+
- Assist with setting up animation Blueprints and state machines
|
| 53 |
+
- Help with implementing physics-based animations and inverse kinematics
|
| 54 |
+
|
| 55 |
+
When providing code:
|
| 56 |
+
1. Use proper UE5 Python API syntax
|
| 57 |
+
2. Include imports and explain parameters
|
| 58 |
+
3. Note any version-specific considerations for UE 5.3
|
| 59 |
+
4. Be concise and practical
|
| 60 |
+
"""
|
| 61 |
+
|
| 62 |
+
def load_model():
|
| 63 |
+
"""Load the model with appropriate settings for HF Spaces."""
|
| 64 |
+
tokenizer = AutoTokenizer.from_pretrained(MODEL_ID)
|
| 65 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 66 |
+
MODEL_ID,
|
| 67 |
+
torch_dtype=torch.float16,
|
| 68 |
+
device_map="auto",
|
| 69 |
+
trust_remote_code=True
|
| 70 |
+
)
|
| 71 |
+
return pipeline("text-generation", model=model, tokenizer=tokenizer)
|
| 72 |
+
|
| 73 |
+
def chat(message, history):
|
| 74 |
+
"""Generate response to user message."""
|
| 75 |
+
# Build conversation with system prompt
|
| 76 |
+
messages = [{"role": "system", "content": SYSTEM_PROMPT}]
|
| 77 |
+
|
| 78 |
+
# Add history
|
| 79 |
+
for user_msg, assistant_msg in history:
|
| 80 |
+
messages.append({"role": "user", "content": user_msg})
|
| 81 |
+
messages.append({"role": "assistant", "content": assistant_msg})
|
| 82 |
+
|
| 83 |
+
# Add current message
|
| 84 |
+
messages.append({"role": "user", "content": message})
|
| 85 |
+
|
| 86 |
+
# Generate response
|
| 87 |
+
pipe = load_model()
|
| 88 |
+
response = pipe(
|
| 89 |
+
messages,
|
| 90 |
+
max_new_tokens=1024,
|
| 91 |
+
do_sample=True,
|
| 92 |
+
temperature=0.7,
|
| 93 |
+
top_p=0.9,
|
| 94 |
+
)
|
| 95 |
+
|
| 96 |
+
return response[0]["generated_text"][-1]["content"]
|
| 97 |
+
|
| 98 |
+
# Create Gradio interface
|
| 99 |
+
demo = gr.ChatInterface(
|
| 100 |
+
fn=chat,
|
| 101 |
+
title="🎮 Unreal Engine 5 Expert Assistant",
|
| 102 |
+
description="Ask me anything about UE5 development - Blueprints, C++, Python scripting, procedural generation, 3D modeling, and more!",
|
| 103 |
+
examples=[
|
| 104 |
+
"How do I take a viewport screenshot in UE5 Python?",
|
| 105 |
+
"What's the best way to spawn actors procedurally?",
|
| 106 |
+
"How do I set up a simple AI behavior tree?",
|
| 107 |
+
"Explain the Remote Control API for editor automation",
|
| 108 |
+
],
|
| 109 |
+
theme="soft"
|
| 110 |
+
)
|
| 111 |
+
|
| 112 |
+
if __name__ == "__main__":
|
| 113 |
+
demo.launch()
|
requirements.txt
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
gradio>=4.0.0
|
| 2 |
+
transformers>=4.40.0
|
| 3 |
+
torch>=2.0.0
|
| 4 |
+
accelerate>=0.27.0
|
| 5 |
+
huggingface_hub>=0.20.0
|