ui updates.
Browse files- .gitattributes +1 -0
- app.py +28 -15
- rayt-0.1.0-cp310-abi3-linux_x86_64.whl +3 -0
- requirements.txt +2 -1
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
rayt-0.1.0-cp310-abi3-linux_x86_64.whl filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
|
@@ -1,15 +1,16 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import io
|
| 3 |
import sys
|
|
|
|
| 4 |
from PIL import Image
|
| 5 |
|
| 6 |
-
from
|
| 7 |
-
|
| 8 |
-
from rayt.
|
| 9 |
-
from rayt.cli import random_scene
|
| 10 |
from rayt.cuda_renderer import render_with_cuda
|
| 11 |
from rayt.numba_renderer import render_with_numba
|
| 12 |
-
|
|
|
|
| 13 |
|
| 14 |
|
| 15 |
def render_image(image_width, samples_per_pixel, aspect_ratio_str, max_depth):
|
|
@@ -34,7 +35,7 @@ def render_image(image_width, samples_per_pixel, aspect_ratio_str, max_depth):
|
|
| 34 |
focus_dist=10.0,
|
| 35 |
)
|
| 36 |
|
| 37 |
-
if
|
| 38 |
render_func = render_with_cuda
|
| 39 |
else:
|
| 40 |
render_func = render_with_numba
|
|
@@ -54,13 +55,13 @@ def render_image(image_width, samples_per_pixel, aspect_ratio_str, max_depth):
|
|
| 54 |
|
| 55 |
# --- Create the Gradio Interface ---
|
| 56 |
with gr.Blocks() as iface:
|
|
|
|
|
|
|
| 57 |
with gr.Row():
|
| 58 |
with gr.Column():
|
| 59 |
-
gr.Markdown("# Ray Tracing in One Weekend")
|
| 60 |
-
|
| 61 |
gr.Markdown("A Python implementation of the book by Peter Shirley, rendered with Numba.")
|
| 62 |
|
| 63 |
-
if
|
| 64 |
gr.Markdown("CUDA support: **<span style='color: green'>AVAILABLE</span>**. Rendering will be done on the GPU.")
|
| 65 |
else:
|
| 66 |
gr.Markdown(
|
|
@@ -69,18 +70,30 @@ with gr.Blocks() as iface:
|
|
| 69 |
"You can also deploy it to a server with CUDA support for faster rendering."
|
| 70 |
)
|
| 71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
gr.Image(
|
| 73 |
label="Sample Output",
|
| 74 |
value="image.webp",
|
| 75 |
show_download_button=False,
|
| 76 |
show_fullscreen_button=False,
|
| 77 |
-
show_label=
|
| 78 |
)
|
| 79 |
-
with gr.Column():
|
| 80 |
-
pass
|
| 81 |
-
|
| 82 |
-
with gr.Column():
|
| 83 |
-
pass
|
| 84 |
|
| 85 |
with gr.Row():
|
| 86 |
with gr.Column():
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import io
|
| 3 |
import sys
|
| 4 |
+
import pandas as pd
|
| 5 |
from PIL import Image
|
| 6 |
|
| 7 |
+
from rayt_rust._core import Camera, Point3, Vec3
|
| 8 |
+
from rayt.gpu_utils import is_cuda_available
|
| 9 |
+
from rayt.scene import random_scene
|
|
|
|
| 10 |
from rayt.cuda_renderer import render_with_cuda
|
| 11 |
from rayt.numba_renderer import render_with_numba
|
| 12 |
+
|
| 13 |
+
IS_CUDA_AVAILABE, _ = is_cuda_available()
|
| 14 |
|
| 15 |
|
| 16 |
def render_image(image_width, samples_per_pixel, aspect_ratio_str, max_depth):
|
|
|
|
| 35 |
focus_dist=10.0,
|
| 36 |
)
|
| 37 |
|
| 38 |
+
if IS_CUDA_AVAILABE:
|
| 39 |
render_func = render_with_cuda
|
| 40 |
else:
|
| 41 |
render_func = render_with_numba
|
|
|
|
| 55 |
|
| 56 |
# --- Create the Gradio Interface ---
|
| 57 |
with gr.Blocks() as iface:
|
| 58 |
+
gr.Markdown("# Ray Tracing in One Weekend")
|
| 59 |
+
|
| 60 |
with gr.Row():
|
| 61 |
with gr.Column():
|
|
|
|
|
|
|
| 62 |
gr.Markdown("A Python implementation of the book by Peter Shirley, rendered with Numba.")
|
| 63 |
|
| 64 |
+
if IS_CUDA_AVAILABE:
|
| 65 |
gr.Markdown("CUDA support: **<span style='color: green'>AVAILABLE</span>**. Rendering will be done on the GPU.")
|
| 66 |
else:
|
| 67 |
gr.Markdown(
|
|
|
|
| 70 |
"You can also deploy it to a server with CUDA support for faster rendering."
|
| 71 |
)
|
| 72 |
|
| 73 |
+
gr.Markdown("## PERFORMANCE")
|
| 74 |
+
gr.Markdown("Machine Configuration:")
|
| 75 |
+
gr.Markdown(
|
| 76 |
+
"""
|
| 77 |
+
- **CPU:** AMD Radeon 9 9900X
|
| 78 |
+
- **GPU:** NVIDIA RTX 5080
|
| 79 |
+
"""
|
| 80 |
+
)
|
| 81 |
+
dataframe = pd.DataFrame({
|
| 82 |
+
"Engine": ["Numba", "Rust", "CUDA"],
|
| 83 |
+
"Image width": ["300", "1200", "2400"],
|
| 84 |
+
"Samples per pixel": ["20", "100", "200"],
|
| 85 |
+
"Duration": ["109.38s", "231.29s", "95.31s"]
|
| 86 |
+
})
|
| 87 |
+
gr.DataFrame(dataframe)
|
| 88 |
+
|
| 89 |
+
with gr.Column():
|
| 90 |
gr.Image(
|
| 91 |
label="Sample Output",
|
| 92 |
value="image.webp",
|
| 93 |
show_download_button=False,
|
| 94 |
show_fullscreen_button=False,
|
| 95 |
+
show_label=True,
|
| 96 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
|
| 98 |
with gr.Row():
|
| 99 |
with gr.Column():
|
rayt-0.1.0-cp310-abi3-linux_x86_64.whl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ae99ef6989bda524742a3004a7ed3705af562b92af2d3501cda3f01c5d6d3a0a
|
| 3 |
+
size 303807
|
requirements.txt
CHANGED
|
@@ -1,2 +1,3 @@
|
|
| 1 |
gradio
|
| 2 |
-
|
|
|
|
|
|
| 1 |
gradio
|
| 2 |
+
numba-cuda[cu13]
|
| 3 |
+
./rayt-0.1.0-cp310-abi3-linux_x86_64.whl
|