瀏覽代碼

fix upload event handler in ai_interface example

Falko Schindler 2 年之前
父節點
當前提交
166abda415
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      examples/ai_interface/main.py

+ 2 - 2
examples/ai_interface/main.py

@@ -15,10 +15,10 @@ async def io_bound(callback: Callable, *args: any, **kwargs: any):
     return await asyncio.get_event_loop().run_in_executor(None, functools.partial(callback, *args, **kwargs))
 
 
-async def transcribe(args: UploadEventArguments):
+async def transcribe(e: UploadEventArguments):
     transcription.text = 'Transcribing...'
     model = replicate.models.get('openai/whisper')
-    prediction = await io_bound(model.predict, audio=io.BytesIO(args.files[0].content))
+    prediction = await io_bound(model.predict, audio=io.BytesIO(e.content))
     text = prediction.get('transcription', 'no transcription')
     transcription.set_text(f'result: "{text}"')