Skip to content

Commit

Permalink
fix ai_interface example
Browse files Browse the repository at this point in the history
  • Loading branch information
falkoschindler committed Jul 26, 2023
1 parent 8c76b8f commit 1f15fe4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples/ai_interface/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async def transcribe(e: UploadEventArguments):
transcription.text = 'Transcribing...'
model = replicate.models.get('openai/whisper')
version = model.versions.get('30414ee7c4fffc37e260fcab7842b5be470b9b840f2b608f5baa9bbef9a259ed')
prediction = await io_bound(version.predict, audio=io.BytesIO(e.content))
prediction = await io_bound(version.predict, audio=io.BytesIO(e.content.read()))
text = prediction.get('transcription', 'no transcription')
transcription.set_text(f'result: "{text}"')

Expand All @@ -35,7 +35,7 @@ async def generate_image():
with ui.row().style('gap:10em'):
with ui.column():
ui.label('OpenAI Whisper (voice transcription)').classes('text-2xl')
ui.upload(on_upload=transcribe).style('width: 20em')
ui.upload(on_upload=transcribe, auto_upload=True).style('width: 20em')
transcription = ui.label().classes('text-xl')
with ui.column():
ui.label('Stable Diffusion (image generator)').classes('text-2xl')
Expand Down

0 comments on commit 1f15fe4

Please sign in to comment.