File tree Expand file tree Collapse file tree 2 files changed +20
-3
lines changed
inference/src/snippets/templates/js/fetch
tasks-gen/snippets-fixtures/text-to-image/js/fetch Expand file tree Collapse file tree 2 files changed +20
-3
lines changed Original file line number Diff line number Diff line change 1
- {% if provider == "hf-inference" %}
2
1
async function query(data) {
3
2
const response = await fetch(
4
3
"{{ fullUrl }}",
@@ -17,5 +16,4 @@ async function query(data) {
17
16
18
17
query({ inputs: {{ providerInputs.asObj.inputs }} }).then((response) => {
19
18
// Use image
20
- });
21
- {% endif %}
19
+ });
Original file line number Diff line number Diff line change
1
+ async function query ( data ) {
2
+ const response = await fetch (
3
+ "https://fal.run/<fal-ai alias for black-forest-labs/FLUX.1-schnell>" ,
4
+ {
5
+ headers : {
6
+ Authorization : "Key api_token" ,
7
+ "Content-Type" : "application/json" ,
8
+ } ,
9
+ method : "POST" ,
10
+ body : JSON . stringify ( data ) ,
11
+ }
12
+ ) ;
13
+ const result = await response . blob ( ) ;
14
+ return result ;
15
+ }
16
+
17
+ query ( { inputs : "Astronaut riding a horse" } ) . then ( ( response ) => {
18
+ // Use image
19
+ } ) ;
You can’t perform that action at this time.
0 commit comments