Spaces:
Sleeping
Sleeping
Calculatot
Browse files
app.py
CHANGED
@@ -7,26 +7,9 @@ from tools.final_answer import FinalAnswerTool
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
Args:
|
14 |
-
prompt: A text description of the image.
|
15 |
-
"""
|
16 |
-
API_URL = "https://api-inference.huggingface.co/models/stabilityai/stable-diffusion-2"
|
17 |
-
HEADERS = {"Authorization": "Bearer YOUR_HUGGINGFACE_API_KEY"}
|
18 |
-
|
19 |
-
payload = {"inputs": prompt}
|
20 |
-
response = requests.post(API_URL, headers=HEADERS, json=payload)
|
21 |
-
|
22 |
-
if response.status_code == 200:
|
23 |
-
image_path = "generated_image.png"
|
24 |
-
with open(image_path, "wb") as file:
|
25 |
-
file.write(response.content)
|
26 |
-
return f"Image successfully generated: {image_path}"
|
27 |
-
else:
|
28 |
-
return f"Error: {response.json()}"
|
29 |
-
|
30 |
@tool
|
31 |
def get_current_time_in_timezone(timezone: str) -> str:
|
32 |
"""A tool that fetches the current local time in a specified timezone.
|
|
|
7 |
|
8 |
from Gradio_UI import GradioUI
|
9 |
|
10 |
+
def calculator(a: int, b: int) -> int:
|
11 |
+
"""Multiply two integers."""
|
12 |
+
return a * b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
@tool
|
14 |
def get_current_time_in_timezone(timezone: str) -> str:
|
15 |
"""A tool that fetches the current local time in a specified timezone.
|