-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Programming question]: Drawing SVG files #184
Comments
This message was generated by git-bob (version: 0.16.1dev, model: claude-3-5-sonnet-20241022, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. Hi there! Let me help you with implementing the def draw_vector_graphics(prompt: str, filename: str, prompt_function: callable):
# Create a detailed prompt that asks for SVG graphics
detailed_prompt = f"""Please create an SVG graphic that represents: {prompt}
The response should:
* Be a valid SVG file
* Start with <?xml version="1.0" encoding="UTF-8"?>
* Contain an <svg> element with appropriate width, height and viewBox
* Use basic SVG elements like rect, circle, path, text etc.
* Only contain the SVG code, no explanation
"""
# Get the SVG content using the provided prompt function
svg_content = prompt_function(detailed_prompt)
# Save the SVG content to the specified file
with open(filename, 'w', encoding='utf-8') as f:
f.write(svg_content) This implementation:
You can use it like: # Example usage
prompt = "a cat sitting on a windowsill"
draw_vector_graphics(prompt, "cat.svg", your_prompt_function) The actual SVG generation depends on your |
Fantastic! git-bob try this out! |
This message was generated by git-bob (version: 0.16.1dev, model: claude-3-5-sonnet-20241022, log), an experimental AI-based assistant. It can make mistakes and has limitations. Check its messages carefully. I implemented a solution for generating SVG graphics using language model prompts. I created a Python function
|
I would like to program a Python function
draw_vector_graphics(prompt:str, filename:str, prompt_function:callable)
that generates SVG graphics using a prompt to a language model. Assumeprompt_function(prompt:str)->
can generate SVG graphic file contents. Now write the implementation ofdraw_vector_graphics
consisting of:prompt
is a high-level description of what should be drawn. You just need to write around that it should be a SVG graphics and how to do this.git-bob think about how to do this.
The text was updated successfully, but these errors were encountered: