xinjie.wang commited on
Commit
46dc1a2
·
1 Parent(s): 36c2c30
Files changed (2) hide show
  1. app.py +2 -0
  2. common.py +14 -0
app.py CHANGED
@@ -23,6 +23,7 @@ from gradio.themes.utils.colors import slate
23
  with gr.Blocks(
24
  delete_cache=(43200, 43200), theme=Default(primary_hue=slate)
25
  ) as demo:
 
26
  gr.Markdown(
27
  f"""
28
  ## Image to 3D Asset Pipeline \n
@@ -42,6 +43,7 @@ with gr.Blocks(
42
  image_mode="RGBA",
43
  type="pil",
44
  height=400,
 
45
  )
46
  gr.Markdown(
47
  """
 
23
  with gr.Blocks(
24
  delete_cache=(43200, 43200), theme=Default(primary_hue=slate)
25
  ) as demo:
26
+ # inject_image_css()
27
  gr.Markdown(
28
  f"""
29
  ## Image to 3D Asset Pipeline \n
 
43
  image_mode="RGBA",
44
  type="pil",
45
  height=400,
46
+ # elem_classes=["image-container"],
47
  )
48
  gr.Markdown(
49
  """
common.py CHANGED
@@ -127,6 +127,20 @@ elif os.getenv("GRADIO_APP") == "texture_edit":
127
  os.makedirs(TMP_DIR, exist_ok=True)
128
 
129
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  def start_session(req: gr.Request) -> None:
131
  user_dir = os.path.join(TMP_DIR, str(req.session_hash))
132
  os.makedirs(user_dir, exist_ok=True)
 
127
  os.makedirs(TMP_DIR, exist_ok=True)
128
 
129
 
130
+ def inject_image_css():
131
+ return gr.HTML(
132
+ """
133
+ <style>
134
+ .image-container img {
135
+ object-fit: contain !important;
136
+ max-width: 100% !important;
137
+ max-height: 100% !important;
138
+ }
139
+ </style>
140
+ """
141
+ )
142
+
143
+
144
  def start_session(req: gr.Request) -> None:
145
  user_dir = os.path.join(TMP_DIR, str(req.session_hash))
146
  os.makedirs(user_dir, exist_ok=True)