Creating Apps with Azure OpenAI Assistants API Using Gradio and Next.js

Overview I created apps using the Azure OpenAI Assistants API with Gradio and Next.js, so here are my notes. Target Data I used articles published on Zenn as the target data. First, I bulk downloaded them with the following code. i f i f p u w f m r m r a r h o p o p o g l i r o m o m e s l r r e u r d a i f p u t i r s h t o w t b t t = = r e a r f o a r e f e o t x s i s q 1 l s t t r g l x s u m t . t r 4 o d 1 [ : p a i l e t o p p l m h e s m ] = o c e b a u i _ s c o = a f q i n = l n r r r + n o . o n = = k o . u m i f s e ( e t l = p p n s h e p w e p m " e r s a a i s t a a t e B s t d e r s o p h e r k c . 1 q t t i e o m i n i t r o t = s = t l a d h h n = a u l r ( t s t r t p i e p m . u u p . s t e t p r o d c p ( = e e r t . g ( e ( B s e n a l i e u x e i f e o x t e t : q s t e n n r f i q f i t s t x a q / u e a s d l " s u u n _ . _ t u d / e . [ ) a ( s d t e l d t p o ) t m z s j ' r " ) a s s S ( e a p i e t s a = t h : t ( t o c x t a f n s o r = i t a t s u l t h t u n . n t c t / e . p a ( . h l . g ( i 0 l p t x g ( s ) d , S d e ) c : e s e t e r s i o e t l s : x _ t e _ r " u v ( e : / t ( s = n w p / u s / p u p " a " a r ' z { a r o z m ) p l ] e u t l n n e i ) n r h ) s c ( a / n l ) e " t s a . . : . ) e r d s t x f t e p e t : i v l x _ c " i t o l t , p e + ( a s ' " t ? a / h h u r ' t ) s t ) m , e i [ l r c - . e n l 1 p x a e ] a i m [ } r s e ' . s t = p t e _ n a x r o a t t " k k h " ) = a ' T m ] r u ) u r e a ) 1 9 6 & p a g e = { p a g e } " Registering to the Vector Store Upload data files with the following code. ...

January 6, 2025 · 13 min · Nakamura

Building a RAG-based Chat Using Azure OpenAI, LlamaIndex, and Gradio

Overview I tried building a RAG-based chat using Azure OpenAI, LlamaIndex, and Gradio, so here are my notes. Azure OpenAI Create an Azure OpenAI resource. Then, click “Endpoint: Click here to view endpoint” to note down the endpoint and key. Then, navigate to the Azure OpenAI Service. Go to “Model catalog” and deploy “gpt-4o” and “text-embedding-3-small”. The result is displayed as follows. Downloading the Text This time, we target “The Tale of Genji” published on Aozora Bunko (a free digital library of Japanese literature). ...

December 16, 2024 · 16 min · Nakamura

Deleting All Files in OpenAI Storage

Overview This is a memo on how to delete all files in OpenAI storage. The following page was helpful. https://community.openai.com/t/deleting-everything-in-storage/664945 Background There was a case where I wanted to bulk-delete multiple files uploaded using code like the following. f f # # f # p p i i i r r l l U a l v Y i i e e s n e e o n n _ _ e d _ c u t t p s b t ( ( a t t p a o c f f t r h o t r a i i h e e l c _ n l l s a l h s e e m u t p _ _ = s p t = o r b b l h r i a a g = o e c e n t t l a l _ t c c o [ d s i i h h b o t e d t . . ( p a a n = h s f " e n t t v e t i d n d u . e a l a ( s b c s t e t p p e t t u _ a a o o t o a s c / t l f a r t ) o t h l . _ u u x , t v s s n t S h e t t / " D e c o a s * r K t r n ) . b f o e d t " h i r . x ) e l _ i t t l e s d h " f p t , e ) o e b o r r a r f f t e i i p t c s l l a o h . e e t f s h u f i = c p o l f o i l r e i u n o _ l n a c b e t f d o a _ s i m t s l t p c t o e h l h r f _ e e e e p t s a t a f i . m h t i o u s e h l n p s e . l b ] s o a , a t d c a _ h d a d n t d o t _ h p s e o e m l e l t ( t o h e t h r e e s v u e l c t t o o r f s t t h o i r s e , o p e r a t i o n . Method Running the following code allowed me to perform bulk deletion. ...

July 24, 2024 · 13 min · Nakamura

Adding Images to IIIF Manifest Files for Audio Materials

Overview This is a note on trying out the Audio Presentation with Accompanying Image recipe. https://iiif.io/api/cookbook/recipe/0014-accompanyingcanvas/ The following is an example displayed in Clover, where the configured image appears in the player. https://samvera-labs.github.io/clover-iiif/docs/viewer/demo?iiif-content=https://nakamura196.github.io/ramp_data/demo/3571280/manifest.json Manifest File Description An example is stored at the following location. https://github.com/nakamura196/ramp_data/blob/main/docs/demo/3571280/manifest.json Specifically, it was necessary to add an accompanyingCanvas to the Canvas as follows. { " " " " } i t d a , d y u c " " " " " ] " p r c i t h w i : e a o d y e i t { } " t m " p i d e " : i p : e g t m " " " ] h o a " h h s i t i t " n n " : t " " d y t { } t C " y h " : : " p e p a : i t " : : e m " " " " } " s n n t C 1 [ " s i t m b , t : 1 g p a 1 0 " : " d y o o " " " " " a / a 5 C s n 0 2 h : " p t d i t h w f r / s 6 a : 2 4 t " : e i y d y e i o g n " . n / a 4 , t A [ " v " " p i d r e a , 0 / s , p n " : a : : e g t m t k 7 a n " s n h t " h h a " a 9 s a , : t " i { " : t " t : m 9 " k t t A o h " : " u 9 : a / a p n n t " : : " r 9 m n t s n " t I 1 h a 9 { u a i : : p m 1 0 " t 1 9 r k o t s a 0 2 i t 9 9 a a n / a " : g 2 4 m p 6 9 1 m P n t p / e 4 , a s . 9 9 u a a i a / " , g : g 9 6 r g k o i n , e / i 9 . a e a n n a / / t 8 g 1 " m " t k j n h , i 9 , u , i a p a u t 6 r n m e k b h . a g u g a . u g 1 " r " m i b i 9 , a u o . t 6 1 r / i h . 9 a r o u g 6 1 a / b i . 9 m r . t g 6 p a i h i . _ m o u t g d p / b h i a _ r . u t t d a i b h a a m o . u / t p / i b d a _ r o . e / d a / i m d a m r o o e t p a / / m a _ m r 3 o / d p a 5 / d a _ m 7 3 e t d p 1 5 m a a _ 2 7 o / t d 8 1 / d a a 0 2 3 e / t / 8 5 m d a c 0 7 o e / a / 1 / m d n c 2 3 o e v a 8 5 / m a n 0 7 3 o s v / 1 5 / " a c 2 7 3 , s a 8 1 5 / n 0 2 7 a v / 8 1 c a c 0 2 c s a / 8 o / n 3 0 m a v 5 / p c a 7 c a c s 1 a n o / 2 n y m a 8 v i p c 0 a n a c _ s g n o s / " y m u a , i p m c n a m c g n a o / y r m a i y p n n _ a n g i n o / m y t a a i a n g n t n e g i o . / o t j a n a p n / t g n p i " o a o , t g n a e / t " i i , m o a n g / e p " a , g e " It may be a bit hard to follow, but here is the code example using iiif_prezi3. The accompanyingCanvas is created via create_accompanying_canvas() and associated with the canvas. ...

July 12, 2024 · 12 min · Nakamura

IIIF Audio/Visual: Describing Multiple VTT Files

Overview This is a note on how to describe multiple VTT files for Audio/Visual materials using IIIF. Here, we describe transcription text in both Japanese and English as shown below. https://ramp.avalonmediasystem.org/?iiif-content=https://nakamura196.github.io/ramp_data/demo/3571280/manifest.json Manifest File Description An example is stored at the following location. https://github.com/nakamura196/ramp_data/blob/main/docs/demo/3571280/manifest.json Please also refer to the following article. Specifically, by describing them as multiple annotations as shown below, they were correctly processed by the Ramp viewer. ...

July 12, 2024 · 9 min · Nakamura

Displaying Audio Files with Subtitles in an IIIF Viewer

Overview I had the opportunity to display audio files with subtitles in an IIIF viewer, so this is a memo. The target is “Accents and Intonation of the Japanese Language (Part 2)” published in the National Diet Library Historical Sound Archive. OpenAI’s Speech to text was used. Please note that the transcription results may contain errors. The following is a display example in Ramp. https://ramp.avalonmediasystem.org/?iiif-content=https://nakamura196.github.io/ramp_data/demo/3571280/manifest.json The following is a display example in Clover. ...

July 10, 2024 · 8 min · Nakamura