ascarlettvfx commited on
Commit
8d419d7
1 Parent(s): 1491886

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -14
app.py CHANGED
@@ -3,20 +3,28 @@ from gradio_client import Client, handle_file
3
 
4
  def predict_depth(image):
5
  client = Client("prs-eth/marigold")
6
-
7
- # Prepare the API call with the necessary parameters
8
- result = client.predict(
9
- handle_file(image), # Image file path
10
- 1, # Example value for 'Ensemble size'
11
- 10, # Example value for 'Number of denoising steps'
12
- "0", # Processing resolution choice
13
- api_name="/submit_depth_fn"
14
- )
15
-
16
- # Process the API response assuming it directly returns a file path for the depth map
17
- if result and result[0]: # Assuming the API returns the image path as the first item in a tuple
18
- output_file_path = result[0] # Directly use the returned file path
19
- return output_file_path # Return the path to the output file for download
 
 
 
 
 
 
 
 
20
  return "No depth output available"
21
 
22
  # Gradio Interface
 
3
 
4
  def predict_depth(image):
5
  client = Client("prs-eth/marigold")
6
+ try:
7
+ # Full parameter set assuming all are required
8
+ result = client.predict(
9
+ handle_file(image),
10
+ 1, # Ensemble size
11
+ 10, # Number of denoising steps
12
+ "0", # Processing resolution
13
+ handle_file('https://example.com/sample_file.pdf'), # Placeholder URL for required file inputs
14
+ handle_file('https://example.com/sample_file.pdf'),
15
+ handle_file('https://example.com/sample_file.pdf'),
16
+ 0.5, # Relative near plane position
17
+ 0.9, # Relative far plane position
18
+ 10, # Embossing level
19
+ 2, # Smoothing filter size
20
+ -50, # Near plane offset
21
+ api_name="/submit_depth_fn"
22
+ )
23
+ if result and result[0]:
24
+ return result[0]
25
+ except Exception as e:
26
+ return f"An error occurred: {str(e)}"
27
+
28
  return "No depth output available"
29
 
30
  # Gradio Interface