104 lines
5.0 KiB
Julia
104 lines
5.0 KiB
Julia
curl http://localhost:8080/v1/audio/speech -H "Content-Type: application/json" -d '{
|
|
"model": "tts-1",
|
|
"input": "The quick brown fox jumped over the lazy dog.",
|
|
"voice": "alloy"
|
|
}' --output speech.mp3
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curl http://localhost:8080/v1/images/generations -H "Content-Type: application/json" -d '{
|
|
"prompt": "floating hair, portrait, ((loli)), ((one girl)), cute face, hidden hands, asymmetrical bangs, beautiful detailed eyes, eye shadow, hair ornament, ribbons, bowties, buttons, pleated skirt, (((masterpiece))), ((best quality)), colorful|((part of the head)), ((((mutated hands and fingers)))), deformed, blurry, bad anatomy, disfigured, poorly drawn face, mutation, mutated, extra limb, ugly, poorly drawn hands, missing limb, blurry, floating limbs, disconnected limbs, malformed hands, blur, out of focus, long neck, long body, Octane renderer, lowres, bad anatomy, bad hands, text",
|
|
"model": "animagine-xl",
|
|
"step": 51,
|
|
"size": "1024x1024"
|
|
}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
curl http://localhost:8080/v1/chat/completions -H "Content-Type: application/json" -d '{
|
|
"model": "gpt-4-vision-preview",
|
|
"messages": [
|
|
{
|
|
"role": "user", "content": [
|
|
{"type":"text", "text": "What is in the image?"},
|
|
{
|
|
"type": "image_url",
|
|
"image_url": {
|
|
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
|
|
}
|
|
}
|
|
],
|
|
"temperature": 0.9
|
|
}
|
|
]
|
|
}'
|
|
|
|
|
|
|
|
""" correct insert statement
|
|
INSERT INTO wine (grape, additional_search_term, acidity, updated_time, country, description, region, tannin, winery, intensity, sweetness, tasting_notes, wine_name, wine_id, wine_type, other_attributes, fizziness, serving_temperature, created_time) VALUES ('new', ARRAY['text1', 'text2'], '0', '2024-10-01T12:08:46.695+00:00', 'new', 'new', 'new', '0', 'ddd', '0', '0', 'new', 'new_wine', 'e1597803-ab5e-4653-935c-38916e2e0827', 'new', '{"attribute": "sometext"}', '0', '0', '2024-10-01T12:08:46.695+00:00')
|
|
"""
|
|
|
|
|
|
data = Dict{Symbol, Any}(:additional_search_term => ["NA1", "NA2"], :acidity => 0, :country => "NA", :description => "NA", :region => "NA", :intensity => 0, :wine_name => "new_wine", :fizziness => 0, :tannin => 0, :winery => "NA", :sweetness => 0, :tasting_notes => "NA", :wine_type => "NA", :other_attributes => Dict{Symbol, Any}(:attribute1 => "sometext", :attribute2 => 0), :serving_temperature => 0, :grape => "NA")
|
|
|
|
|
|
|
|
|
|
I have a Postgres table created with this SQL:
|
|
CREATE TABLE wine (wine_id uuid, intensity integer, sweetness integer, tannin integer, acidity integer, fizziness integer, other_attributes jsonb, created_time timestamp with time zone, updated_time timestamp with time zone, description text, tasting_notes text, wine_name character varying, winery character varying, region character varying, country character varying, wine_type character varying, grape character varying, serving_temperature character varying, additional_search_term ARRAY);
|
|
|
|
Here are the data for updating:
|
|
update_data = Dict{Symbol, Any}(:additional_search_term => ["NA1", "NA2"], :acidity => "0", :country => "NA", :description => "NA", :region => "NA", :intensity => "0", :wine_name => "new_wine", :wine_id => "9e1deb6a-d57f-4d2c-abbe-da813f4e91ad", :fizziness => "0", :tannin => "0", :winery => "ccc", :sweetness => "0", :tasting_notes => "NA", :wine_type => "NA", :other_attributes => "{\"attribute3\":{\"attribute5\":666,\"attribute4\":\"text\"},\"attribute1\":\"hello world\",\"attribute2\":555}", :serving_temperature => "0", :grape => "NA")
|
|
|
|
Write a Julia function to generate SQL statement to update the table.
|
|
I will provide the following as arguments:
|
|
1) table name
|
|
2) a dictionary for update data with symbol keys
|
|
3) the list of keys in the dictionary that are the table id.
|
|
|
|
I also need a Julia function to insert data into the table.
|
|
|
|
P.S. 1) do not use a comprehension. 2) Postgres jsonb column requires this form: '{"key1": value, "key2": "text", ...}'
|
|
|
|
|
|
|
|
|
|
Here is an example of a Julia dictionary:
|
|
insert_data = Dict{Symbol, Any}(:additional_search_term => ["NA1", "NA2"], :acidity => 0, :country => "NA", :description => "NA", :region => "NA", :intensity => 0, :wine_name => "new_wine", :fizziness => 0, :tannin => 0, :winery => "NA", :sweetness => 0, :tasting_notes => "NA", :wine_type => "NA", :other_attributes => "{\"attribute3\":{\"attribute5\":666,\"attribute4\":\"text\"},\"attribute1\":\"hello world\",\"attribute2\":555}", :serving_temperature => 0, :grape => "NA")
|
|
|
|
I also need a Julia function to insert data into the table.
|
|
|
|
P.S. 1) do not use a comprehension. 2) Postgres jsonb column requires this form: '{"key1": value, "key2": "text", ...}'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
d = Dict(
|
|
:attribute1 => "hello world",
|
|
:attribute2 => 555,
|
|
:attribute3 => Dict(
|
|
:attribute4 => "text",
|
|
:attribute5 => 666
|
|
)
|
|
)
|
|
|
|
# println hello world
|
|
println(d[:attribute1])
|
|
|
|
|
|
'{"attribute3":{"attribute5":666,"attribute4":"text"},"attribute1":"hello world","attribute2":555}'
|
|
|
|
|