Spaces:
Sleeping
Sleeping
Commit
·
e79eb5e
1
Parent(s):
e2b6ad9
[fix] Use temp directory for output to avoid write permission error
Browse files- app.py +1 -6
- src/synth_data_gen.py +2 -1
app.py
CHANGED
|
@@ -5,10 +5,5 @@ if __name__ == "__main__":
|
|
| 5 |
ui = build_ui()
|
| 6 |
|
| 7 |
# Launch the UI in the browser with access to the "output" folder
|
| 8 |
-
ui.launch(
|
| 9 |
-
inbrowser=True,
|
| 10 |
-
allowed_paths=["output"],
|
| 11 |
-
server_name="0.0.0.0",
|
| 12 |
-
server_port=7860
|
| 13 |
-
)
|
| 14 |
|
|
|
|
| 5 |
ui = build_ui()
|
| 6 |
|
| 7 |
# Launch the UI in the browser with access to the "output" folder
|
| 8 |
+
ui.launch(server_name="0.0.0.0", server_port=7860, allowed_paths=[self.output_dir])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
|
src/synth_data_gen.py
CHANGED
|
@@ -3,11 +3,12 @@ from datetime import datetime
|
|
| 3 |
from .prompts import build_user_prompt, system_message
|
| 4 |
from .models import get_gpt_completion, get_claude_completion
|
| 5 |
from .utils import execute_code_in_virtualenv
|
|
|
|
| 6 |
|
| 7 |
class SynthDataGen:
|
| 8 |
def __init__(self, output_dir="output"):
|
| 9 |
# Set the default output directory and ensures it's created
|
| 10 |
-
self.output_dir =
|
| 11 |
os.makedirs(self.output_dir, exist_ok=True)
|
| 12 |
|
| 13 |
def get_timestamp(self):
|
|
|
|
| 3 |
from .prompts import build_user_prompt, system_message
|
| 4 |
from .models import get_gpt_completion, get_claude_completion
|
| 5 |
from .utils import execute_code_in_virtualenv
|
| 6 |
+
import tempfile
|
| 7 |
|
| 8 |
class SynthDataGen:
|
| 9 |
def __init__(self, output_dir="output"):
|
| 10 |
# Set the default output directory and ensures it's created
|
| 11 |
+
self.output_dir = os.path.join(tempfile.gettempdir(), "output")
|
| 12 |
os.makedirs(self.output_dir, exist_ok=True)
|
| 13 |
|
| 14 |
def get_timestamp(self):
|