@@ -174,7 +174,7 @@ import replicate
174174
175175flux_dev = replicate.use("black-forest-labs/flux-dev")
176176
177- def main () -> None:
177+ def run () -> None:
178178 outputs = flux_dev(prompt="a cat wearing an amusing hat")
179179
180180 for output in outputs:
@@ -188,7 +188,7 @@ import replicate
188188
189189claude = replicate.use("anthropic/claude-4-sonnet")
190190
191- def main () -> None:
191+ def run () -> None:
192192 output = claude(prompt="Give me a recipe for tasty smashed avocado on sourdough toast that could feed all of California.")
193193
194194 print(output) # "Here's a recipe to feed all of California (about 39 million people)! ..."
@@ -202,7 +202,7 @@ import replicate
202202flux_dev = replicate.use("black-forest-labs/flux-dev")
203203claude = replicate.use("anthropic/claude-4-sonnet")
204204
205- def main () -> None:
205+ def run () -> None:
206206 images = flux_dev(prompt="a cat wearing an amusing hat")
207207
208208 result = claude(prompt="describe this image for me", image=images[0])
@@ -220,7 +220,7 @@ import replicate
220220
221221claude = replicate.use("anthropic/claude-4-sonnet")
222222
223- def main () -> None:
223+ def run () -> None:
224224 prediction = claude.create(prompt="Give me a recipe for tasty smashed avocado on sourdough toast that could feed all of California.")
225225
226226 prediction.logs() # get current logs (WIP)
@@ -239,7 +239,7 @@ import replicate
239239
240240claude = replicate.use("anthropic/claude-4-sonnet", streaming=True)
241241
242- def main () -> None:
242+ def run () -> None:
243243 output = claude(prompt="Give me a recipe for tasty smashed avocado on sourdough toast that could feed all of California.")
244244
245245 for chunk in output:
@@ -260,7 +260,7 @@ from PIL import Image
260260
261261flux_dev = replicate.use("black-forest-labs/flux-dev")
262262
263- def main () -> None:
263+ def run () -> None:
264264 images = flux_dev(prompt="a cat wearing an amusing hat")
265265 for i, path in enumerate(images):
266266 with Image.open(path) as img:
@@ -275,7 +275,7 @@ import requests
275275
276276flux_dev = replicate.use("black-forest-labs/flux-dev")
277277
278- def main () -> None:
278+ def run () -> None:
279279 images = flux_dev(prompt="a cat wearing an amusing hat")
280280 for path in images:
281281 with open(path, "rb") as f:
@@ -292,7 +292,7 @@ from replicate import get_path_url
292292
293293flux_dev = replicate.use("black-forest-labs/flux-dev")
294294
295- def main () -> None:
295+ def run () -> None:
296296 outputs = flux_dev(prompt="a cat wearing an amusing hat")
297297
298298 for output in outputs:
@@ -307,14 +307,14 @@ By default `use()` will return a function instance with a sync interface. You ca
307307import asyncio
308308import replicate
309309
310- async def main ():
310+ async def run ():
311311 flux_dev = replicate.use("black-forest-labs/flux-dev", use_async=True)
312312 outputs = await flux_dev(prompt="a cat wearing an amusing hat")
313313
314314 for output in outputs:
315315 print(Path(output))
316316
317- asyncio.run(main ())
317+ asyncio.run(run ())
318318` ` `
319319
320320When used in streaming mode then an `OutputIterator` will be returned which conforms to the `AsyncIterator` interface.
@@ -323,7 +323,7 @@ When used in streaming mode then an `OutputIterator` will be returned which conf
323323import asyncio
324324import replicate
325325
326- async def main ():
326+ async def run ():
327327 claude = replicate.use("anthropic/claude-3.5-haiku", streaming=True, use_async=True)
328328 output = await claude(prompt="say hello")
329329
@@ -336,7 +336,7 @@ async def main():
336336 # on the model schema by looking for `x-cog-display: concatenate`.
337337 print(await output)
338338
339- asyncio.run(main ())
339+ asyncio.run(run ())
340340```
341341
342342### Typing
@@ -356,7 +356,7 @@ def hint(*, prompt: str, image: Path | None = None, seed: int | None = None) ->
356356
357357flux_dev = replicate.use(" black-forest-labs/flux-dev" , hint = hint)
358358
359- def main () -> None :
359+ def run () -> None :
360360 output1 = flux_dev() # will warn that `prompt` is missing
361361 output2 = flux_dev(prompt = " str" ) # output2 will be typed as `str`
362362```
@@ -376,7 +376,7 @@ class FluxDev:
376376
377377flux_dev = replicate.use(FluxDev())
378378
379- def main () -> None :
379+ def run () -> None :
380380 output1 = flux_dev() # will warn that `prompt` is missing
381381 output2 = flux_dev(prompt = " str" ) # output2 will be typed as `str`
382382```
@@ -762,7 +762,7 @@ from cog import Path
762762
763763flux_dev = replicate.use(" black-forest-labs/flux-dev" )
764764
765- def main (prompt: str ) -> list[Path]:
765+ def run (prompt: str ) -> list[Path]:
766766 outputs = flux_dev(prompt = prompt)
767767 return [Path(p) for p in outputs]
768768
0 commit comments