TieuDaoChanNhan commited on
Commit
40d0046
·
1 Parent(s): 9ed46d3
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -123,7 +123,7 @@ def load_models_correct_architecture(checkpoint_path):
123
 
124
  try:
125
  # Load checkpoint
126
- checkpoint = torch.load(checkpoint_path, map_location=device, weights_only=False)
127
  print("🔍 Checkpoint structure:")
128
  print(f"Keys: {list(checkpoint.keys())}")
129
 
@@ -261,8 +261,12 @@ def generate_emoji_fixed(input_image):
261
  print("✅ Main inference function ready!")
262
 
263
  def gradio_wrapper(input_image):
264
- result = generate_emoji_fixed(input_image)
265
- return result
 
 
 
 
266
 
267
  if __name__ == "__main__":
268
  # try:
@@ -295,5 +299,6 @@ if __name__ == "__main__":
295
 
296
  # Launch
297
  print("🌐 Launching Fixed DTN Demo...")
298
- port = int(os.environ.get("PORT", 7860))
299
- demo.launch(server_name="0.0.0.0", server_port=port, share=False, debug=False)
 
 
123
 
124
  try:
125
  # Load checkpoint
126
+ checkpoint = torch.load(checkpoint_path, map_location=device)
127
  print("🔍 Checkpoint structure:")
128
  print(f"Keys: {list(checkpoint.keys())}")
129
 
 
261
  print("✅ Main inference function ready!")
262
 
263
  def gradio_wrapper(input_image):
264
+ img = generate_emoji_fixed(input_image)
265
+ if isinstance(img, tuple):
266
+ # ignore status message, chỉ return image
267
+ img = img[0]
268
+ return img
269
+
270
 
271
  if __name__ == "__main__":
272
  # try:
 
299
 
300
  # Launch
301
  print("🌐 Launching Fixed DTN Demo...")
302
+ # port = int(os.environ.get("PORT", 7860))
303
+ # demo.launch(server_name="0.0.0.0", server_port=port, share=False, debug=False)
304
+ demo.launch(debug=True)