adding GPU spaces function
Browse files
app.py
CHANGED
|
@@ -3,10 +3,20 @@ import datetime
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
|
|
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 11 |
@tool
|
| 12 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
import spaces
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
+
image_generation_tool = load_tool(
|
| 12 |
+
"agents-course/text-to-image",
|
| 13 |
+
trust_remote_code=True
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
@spaces.GPU
|
| 17 |
+
def generate_image(prompt):
|
| 18 |
+
return image_generation_tool(prompt)
|
| 19 |
+
|
| 20 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 21 |
@tool
|
| 22 |
def my_custom_tool(arg1:str, arg2:int)-> str: #it's import to specify the return type
|