AMfeta99 commited on
Commit
08ac9f6
·
verified ·
1 Parent(s): 4ff0bf6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -21
app.py CHANGED
@@ -63,32 +63,17 @@ def generate_prompts_for_object(object_name):
63
  "future": f"Show a futuristic version of a {object_name}, by predicting advanced features and futuristic design."
64
  }
65
 
66
- '''
67
  image_generation_tool = Tool.from_space(
68
- "KingNish/Realtime-FLUX",
69
- api_name="/predict", # Optional if there's only one endpoint
70
- name="image_generator",
71
- description="Generate an image from a prompt"
72
- )
73
- '''
74
- import requests
75
- from smolagents import Tool
76
-
77
- def flux_proxy(user_prompt: str):
78
- # Call the Hugging Face Space API directly
79
- url = "https://black-forest-labs-flux-1-schnell.hf.space/run/infer"
80
- headers = {"Authorization": f"Bearer {token}"}
81
- response = requests.post(url, headers=headers, json={"data": [user_prompt]})
82
- response.raise_for_status()
83
- output_url = response.json()["data"][0] # Usually a URL or base64 image
84
- return output_url # Adjust this based on your agent's expectations
85
-
86
- image_generation_tool = Tool.from_function(
87
- fn=flux_proxy,
88
  name="image_generator",
89
  description="Generate an image from a prompt"
90
  )
91
 
 
92
  # =========================================================
93
  # Tool and Agent Initialization
94
  # =========================================================
 
63
  "future": f"Show a futuristic version of a {object_name}, by predicting advanced features and futuristic design."
64
  }
65
 
66
+
67
  image_generation_tool = Tool.from_space(
68
+ #"KingNish/Realtime-FLUX",
69
+ "black-forest-labs/FLUX.1-schnell",
70
+ num_inference_steps=4,
71
+ api_name="/infer"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
  name="image_generator",
73
  description="Generate an image from a prompt"
74
  )
75
 
76
+
77
  # =========================================================
78
  # Tool and Agent Initialization
79
  # =========================================================