John6666 commited on
Commit
f476e37
·
verified ·
1 Parent(s): b17a451

Upload t2i_space.py

Browse files
Files changed (1) hide show
  1. t2i_space.py +2 -0
t2i_space.py CHANGED
@@ -1,4 +1,5 @@
1
  from pathlib import Path
 
2
 
3
 
4
  def is_repo_name(s):
@@ -33,6 +34,7 @@ def save_space_contents(repo_id: str, dir: str):
33
  if not is_repo_name(repo_id) or not is_repo_exists(repo_id) or not is_repo_t2i(repo_id):
34
  print(f"Error: Invalid repo ID: {repo_id}. ")
35
  return []
 
36
  model_name = repo_id.split("/")[-1]
37
  app_py = f"""
38
  import gradio as gr
 
1
  from pathlib import Path
2
+ import os
3
 
4
 
5
  def is_repo_name(s):
 
34
  if not is_repo_name(repo_id) or not is_repo_exists(repo_id) or not is_repo_t2i(repo_id):
35
  print(f"Error: Invalid repo ID: {repo_id}. ")
36
  return []
37
+ os.makedirs(dir, exist_ok=True)
38
  model_name = repo_id.split("/")[-1]
39
  app_py = f"""
40
  import gradio as gr