Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,20 +3,121 @@ 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
|
| 13 |
#Keep this format for the description / args / args description but feel free to modify the tool
|
| 14 |
-
"""
|
| 15 |
Args:
|
| 16 |
-
arg1: the first argument
|
| 17 |
-
arg2: the second argument
|
| 18 |
"""
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
|
| 21 |
@tool
|
| 22 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
@@ -55,7 +156,7 @@ with open("prompts.yaml", 'r') as stream:
|
|
| 55 |
|
| 56 |
agent = CodeAgent(
|
| 57 |
model=model,
|
| 58 |
-
tools=[final_answer], ## add your tools here (don't remove final answer)
|
| 59 |
max_steps=6,
|
| 60 |
verbosity_level=1,
|
| 61 |
grammar=None,
|
|
|
|
| 3 |
import requests
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
+
import random
|
| 7 |
from tools.final_answer import FinalAnswerTool
|
| 8 |
|
| 9 |
from Gradio_UI import GradioUI
|
| 10 |
|
| 11 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
| 12 |
@tool
|
| 13 |
+
def select_random_image_style()-> 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 |
+
"""Select a random image style to pass to image generation together with the user's input
|
| 16 |
Args:
|
|
|
|
|
|
|
| 17 |
"""
|
| 18 |
+
image_styles = [
|
| 19 |
+
{
|
| 20 |
+
"name": "Flat Design",
|
| 21 |
+
"description": "Ultra-simplified, two-dimensional visuals with no depth cues.",
|
| 22 |
+
"key_elements": [
|
| 23 |
+
"Solid, un-textured color blocks",
|
| 24 |
+
"Minimal or zero gradients/shadows",
|
| 25 |
+
"Crisp vector edges",
|
| 26 |
+
"High foreground–background contrast",
|
| 27 |
+
],
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"name": "Low-Poly",
|
| 31 |
+
"description": "Imagery built from large, faceted polygons, echoing early 3-D graphics.",
|
| 32 |
+
"key_elements": [
|
| 33 |
+
"20–200 visible polygon faces",
|
| 34 |
+
"Hard edges, no smoothing",
|
| 35 |
+
"One flat color per face",
|
| 36 |
+
"Directional lighting to emphasize facets",
|
| 37 |
+
],
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"name": "Cyberpunk Neon",
|
| 41 |
+
"description": "Futuristic, dystopian cityscapes drenched in glowing signage.",
|
| 42 |
+
"key_elements": [
|
| 43 |
+
"High-saturation magentas, cyans, blues",
|
| 44 |
+
"Rim lighting and bloom effects",
|
| 45 |
+
"Rain-slicked reflections",
|
| 46 |
+
"Dense vertical composition with cluttered signage",
|
| 47 |
+
],
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"name": "Studio Portrait (Rembrandt Lighting)",
|
| 51 |
+
"description": "Classical studio portrait with the signature cheek-triangle of light.",
|
| 52 |
+
"key_elements": [
|
| 53 |
+
"Single softbox at ~45°",
|
| 54 |
+
"Triangle of light under shadow-side eye",
|
| 55 |
+
"Low-key background, gentle fall-off",
|
| 56 |
+
"Natural skin tones, minimal retouch",
|
| 57 |
+
],
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"name": "Watercolor Wash",
|
| 61 |
+
"description": "Loose, translucent paint strokes and bleeds on textured paper.",
|
| 62 |
+
"key_elements": [
|
| 63 |
+
"Soft edges and color bleeding",
|
| 64 |
+
"Paper grain visible",
|
| 65 |
+
"Low-contrast outlines or none",
|
| 66 |
+
"Wet-on-wet and drybrush variation",
|
| 67 |
+
],
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"name": "Art Deco Poster",
|
| 71 |
+
"description": "1920s–30s luxury aesthetic with bold geometry and metallic accents.",
|
| 72 |
+
"key_elements": [
|
| 73 |
+
"Symmetry, stepped forms, sunbursts",
|
| 74 |
+
"Narrow stylized typography",
|
| 75 |
+
"Gold, black, cream, teal palette",
|
| 76 |
+
"Elongated figures or transport motifs",
|
| 77 |
+
],
|
| 78 |
+
},
|
| 79 |
+
{
|
| 80 |
+
"name": "Noir Film Still",
|
| 81 |
+
"description": "High-contrast B&W cinematography evoking 1940s crime drama.",
|
| 82 |
+
"key_elements": [
|
| 83 |
+
"Hard key plus side/back lights",
|
| 84 |
+
"Deep blacks, clipped highlights",
|
| 85 |
+
"Venetian-blind or window-frame shadows",
|
| 86 |
+
"Urban set dressing, cigarette haze",
|
| 87 |
+
],
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"name": "Ghibli-Inspired Pastel Fantasy",
|
| 91 |
+
"description": "Soft, whimsical landscapes reminiscent of Studio Ghibli backgrounds.",
|
| 92 |
+
"key_elements": [
|
| 93 |
+
"Pastel greens, blues, creams",
|
| 94 |
+
"Painterly visible brush strokes",
|
| 95 |
+
"Nature focus: rolling hills, fluffy clouds",
|
| 96 |
+
"Tiny architectural details for scale",
|
| 97 |
+
],
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"name": "Brutalist Collage",
|
| 101 |
+
"description": "Raw photomontage reflecting Brutalist concrete heft.",
|
| 102 |
+
"key_elements": [
|
| 103 |
+
"Greyscale concrete textures",
|
| 104 |
+
"Blocky, asymmetric composition",
|
| 105 |
+
"Bold Helvetica-style typography",
|
| 106 |
+
"Occasional harsh primary accent",
|
| 107 |
+
],
|
| 108 |
+
},
|
| 109 |
+
{
|
| 110 |
+
"name": "Glitch Vaporwave",
|
| 111 |
+
"description": "Retro-digital aesthetic mixing ’80s nostalgia with data corruption artifacts.",
|
| 112 |
+
"key_elements": [
|
| 113 |
+
"CRT scanlines, RGB channel shifts, datamosh blocks",
|
| 114 |
+
"Sunset gradients (purple→pink→orange)",
|
| 115 |
+
"Greek busts, palm trees, wireframe grids",
|
| 116 |
+
"Oversized Japanese katakana/kanji overlays",
|
| 117 |
+
],
|
| 118 |
+
},
|
| 119 |
+
]
|
| 120 |
+
return image_styles[random.randint(0,len(image_styles))]
|
| 121 |
|
| 122 |
@tool
|
| 123 |
def get_current_time_in_timezone(timezone: str) -> str:
|
|
|
|
| 156 |
|
| 157 |
agent = CodeAgent(
|
| 158 |
model=model,
|
| 159 |
+
tools=[final_answer, image_generation_tool, select_random_image_style], ## add your tools here (don't remove final answer)
|
| 160 |
max_steps=6,
|
| 161 |
verbosity_level=1,
|
| 162 |
grammar=None,
|