Stubbs0x commited on
Commit
34154dd
·
verified ·
1 Parent(s): 231ab65

Update app.py

Browse files

![IMG_1374](https://cdn-uploads.huggingface.co/production/uploads/643e21ed7cd64d872cbb0e06/zaLiGDNIOHgUHhy08iTxB.jpeg)

Files changed (1) hide show
  1. app.py +27 -5
app.py CHANGED
@@ -10,14 +10,36 @@ from gradio_client import Client, handle_file
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
- def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
  """A tool that uses the HuggingFace Space "frogleo/Image-to-3D" to transform a 2D image into a 3D model
16
  Args:
17
- arg1: the first argument
18
- arg2: the second argument
19
  """
20
- return "What magic will you build ?"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  @tool
23
  def get_current_time_in_timezone(timezone: str) -> str:
@@ -56,7 +78,7 @@ with open("prompts.yaml", 'r') as stream:
56
 
57
  agent = CodeAgent(
58
  model=model,
59
- tools=[final_answer], ## add your tools here (don't remove final answer)
60
  max_steps=6,
61
  verbosity_level=1,
62
  grammar=None,
 
10
 
11
  # Below is an example of a tool that does nothing. Amaze us with your creativity !
12
  @tool
13
+ def image_to_3d(image_path:str)-> dict: #it's import to specify the return type
14
  #Keep this format for the description / args / args description but feel free to modify the tool
15
  """A tool that uses the HuggingFace Space "frogleo/Image-to-3D" to transform a 2D image into a 3D model
16
  Args:
17
+ image_path: A string with the path to the 2D image that will be used
18
+
19
  """
20
+
21
+ client = Client("frogleo/Image-to-3D")
22
+ result = client.predict(
23
+ image=image_path,
24
+ steps=5,
25
+ guidance_scale=5.5,
26
+ seed=1234,
27
+ octree_resolution=256,
28
+ num_chunks=8000,
29
+ target_face_num=10000,
30
+ randomize_seed=True,
31
+ api_name="/gen_shape"
32
+ )
33
+ print(result)
34
+
35
+ return {
36
+ "glb_path": result[2],
37
+ "obj_path": result[3],
38
+ "file_export": result[1],
39
+ "html_preview": result[0]
40
+ }
41
+
42
+
43
 
44
  @tool
45
  def get_current_time_in_timezone(timezone: str) -> str:
 
78
 
79
  agent = CodeAgent(
80
  model=model,
81
+ tools=[final_answer, image_to_3d], ## add your tools here (don't remove final answer)
82
  max_steps=6,
83
  verbosity_level=1,
84
  grammar=None,