Spaces:
Sleeping
Sleeping
Stephen
commited on
Commit
·
e7bae15
1
Parent(s):
511a384
switch to using tempfile
Browse files
app.py
CHANGED
@@ -1,10 +1,18 @@
|
|
1 |
import gradio as gr
|
2 |
from sdf_export import mesh_to_sdf_glsl
|
|
|
|
|
3 |
|
4 |
|
5 |
def generate_sdf_glsl(file_obj):
|
6 |
glsl_code = mesh_to_sdf_glsl(file_obj.name)
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
|
9 |
|
10 |
iface = gr.Interface(
|
|
|
1 |
import gradio as gr
|
2 |
from sdf_export import mesh_to_sdf_glsl
|
3 |
+
import tempfile
|
4 |
+
import os
|
5 |
|
6 |
|
7 |
def generate_sdf_glsl(file_obj):
|
8 |
glsl_code = mesh_to_sdf_glsl(file_obj.name)
|
9 |
+
|
10 |
+
# Create a temporary file for the GLSL code
|
11 |
+
with tempfile.NamedTemporaryFile(mode="w", suffix=".glsl", delete=False) as f:
|
12 |
+
f.write(glsl_code)
|
13 |
+
temp_path = f.name
|
14 |
+
|
15 |
+
return glsl_code, temp_path
|
16 |
|
17 |
|
18 |
iface = gr.Interface(
|