RamAnanth1 commited on
Commit
03fe055
·
verified ·
1 Parent(s): 6a0971d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -5
app.py CHANGED
@@ -18,8 +18,8 @@ toxicity = Detoxify('original')
18
  # Constants
19
  ####################################
20
  AVAILABLE_MODELS = {
21
- 'TripoSR': 'TripoSR',
22
- 'LGM-Mini': 'LGM-Mini',
23
  }
24
 
25
  SPACE_ID = os.getenv('SPACE_ID')
@@ -313,16 +313,17 @@ with gr.Blocks() as leaderboard:
313
  reloadbtn.click(get_leaderboard, inputs=[reveal_prelim], outputs=[df])
314
 
315
  def synthandreturn(image):
316
-
 
317
  # Get two random models
318
  mdl1, mdl2 = random.sample(list(AVAILABLE_MODELS.keys()), 2)
319
  print("[debug] Using", mdl1, mdl2)
320
  def predict_and_update_result(image, model, result_storage):
321
  try:
322
  if model in AVAILABLE_MODELS:
323
- result = router.predict(image, AVAILABLE_MODELS[model].lower(), api_name="/synthesize")
324
  else:
325
- result = router.predict(image, model.lower(), api_name="/synthesize")
326
  except:
327
  raise gr.Error('Unable to call API, please try again :)')
328
  print('Done with', model)
 
18
  # Constants
19
  ####################################
20
  AVAILABLE_MODELS = {
21
+ 'triposr': 'TripoSR',
22
+ 'lgm-mini': 'LGM-Mini',
23
  }
24
 
25
  SPACE_ID = os.getenv('SPACE_ID')
 
313
  reloadbtn.click(get_leaderboard, inputs=[reveal_prelim], outputs=[df])
314
 
315
  def synthandreturn(image):
316
+ file_path = "temp.png"
317
+ image.save(file_path)
318
  # Get two random models
319
  mdl1, mdl2 = random.sample(list(AVAILABLE_MODELS.keys()), 2)
320
  print("[debug] Using", mdl1, mdl2)
321
  def predict_and_update_result(image, model, result_storage):
322
  try:
323
  if model in AVAILABLE_MODELS:
324
+ result = router.predict(file_path, AVAILABLE_MODELS[model].lower(), api_name="/synthesize")
325
  else:
326
+ result = router.predict(file_path, model.lower(), api_name="/synthesize")
327
  except:
328
  raise gr.Error('Unable to call API, please try again :)')
329
  print('Done with', model)