Event page: https://www.meetup.com/deep-learning-adventures/events/298617011

    Join us for a fun community adventure on our journey to deep learning and data science in general ๐ŸŽ‰ We will continue our journey into the world of generative AI by building cool Gen AI applications together using Streamlit and Gradio.

    Note: This is a hybrid event taking place both in person as well as online! Please read the instructions carefully for each option. Feel free to post a comment here on Meetup if you have any questions or issues joining us in person or online.

    In Person: Excella Offices at 2300 Wilson Blvd Suite 600 ยท Arlington, VA
    Please use the garage door entrance around the corner on N Adams St if the front door is locked. Look for signs for our meetup and take the elevator to the 6th floor ๐Ÿ˜€

    Online: I will post the Zoom link here 15 mins before the event starts.
    I will use a passcode that I will share on our #events channel in Slack.
    This is to prevent uninvited guests.
    I strongly recommend you join us on Slack in advance.

    Agenda
    6:30pm – 7pm EST Networking and Refreshments
    7pm – 8pm EST A gentle introduction to ML Apps with Streamlit and Gradio
    Streamlit Resources: https://drive.google.com/drive/folders/1Zh8Zt2Q8dZTpCEQuq5MfMcICwjnkW_aM?usp=sharing
    Gradio Resources: https://drive.google.com/drive/folders/15azlzueEHklCo4OdeSkFryPP-RK01fAt?usp=sharing
    8pm – 8:30pm Networking and Refreshments
    The recording of this cool series ๐Ÿ˜Ž is available at:
    https://bit.ly/dla-generative-ai

    Deep Learning YouTube playlists, feel free to share and subscribe ๐Ÿ˜€
    https://bit.ly/dla-youtube

    Join us on Slack:
    https://join.slack.com/t/deeplearninga-nmk8930/shared_invite/zt-zv6nq4xi-AxNEuQn_sc4lSntZZh_UkA

    Spread the word about our meetup and we look forward to seeing you on our next adventure ๐ŸŽ‰

    Are you excited to join us? See you soon ๐Ÿ˜Ž
    Best,
    George, Robert and David

    Deep Learning Adventures is a member of Data Community DC, a nonprofit dedicated to data education in the nation’s capital and around the world. Learn more at www.dc2.org

    Cool we’re good so as I was saying this was a fun one um think of it as a way to have a user interface in in front of your ml app um so it was a good one cool in terms of other resources we have a YouTube channel uh you can see some

    Other sessions we’ve had here in the past we’re trying to follow the uh the Deep learning AI sessions uh the short courses are really good uh so we did a couple of them on Chad GPT the open ey um version or the API of it with a

    Couple of Hands-On or with no code sessions here where you could use uh simple prompting to do something fun without pretty much any code uh we build something like a very rag basic system as your company anything you have your company data you interact with it uh you

    Query it you get answers back we work with whisper one of the apis that transcribes audio to text think of you’re in a meeting or in a session like today you’re only interested in the audio part um uh you want to transcribe it and maybe summarize it or key take

    Key next steps and so forth and then we had some more advanced sessions in terms of maybe you want to build an AI assistant that is aware of your company structure maybe you have a different team like a HR team or Finance team or a building team or tech support team how

    Do you treiz that how do you treiz that request to the different uh departments which where each one of them has a a dedicated ass system then last session we kicked off this generative AI uh session I’ll quickly do a plugin for that I have the link in the comments somewhere in the

    Event um let’s see I thought I posted it um looks like I’m a log in that’s the problem yeah probably that’s right okay meet up feature you have to log into the comments okay um so here I have a link and um I’ll make this a little bit

    Bigger but we had some good ideas from the community we can go over this in the end anything from chat with your data get to know the story behind your book uh create like a simple chat bot we have some that had a lot of requests here for

    Uh an a assistant for our our community here our deep learning community and on YouTube find one that meets your dietary restrictions you know there’s there’s different cool cool ideas here that um we’re going to start working on them soon cool so here I posted a couple of

    Links uh one of them is this streamlet resources uh it’s a folder um that has a little bit of um code and what you need are you sharing are you sharing sorry I’m sorry I’m not sharing you’re absolutely right uh so I Shar the Meetup I Shar the Community page uh my our

    YouTube um and then the streamly part it’s a Google Drive repository we’re going to go over today what we’re going to talk about stream lip but really if you go to stream.io you’ll see this main website which has a good idea of how to do it

    You know how do you go from code to an application and and it’s really cool um I like their documentation so that’s that’s what we’re going to quickly go over today the installation part you know P install streamlit and you’re good to go um you can build an application by just

    Starting streamlet hello it will run it will run a streamlet server on your on your device that you can interact with and uh there are some fundamental concepts that uh we can go over so let me make this a little bit bigger perfect

    So yeah as I said uh once you s stream L you can run your script by stream L run and then your script name um some optional arguments there you don’t really have to see them now but the flow is simple you you develop something you save your file there’s an option in

    Streamlet where you can say reload the server and the actual page will reload so it’s it’s that tightly integrated um so yeah every time you modify your source code or every time you you interact with your app the ire workflow will will will restart and streamly executes python code from top

    To bottom as we’ll see you can display install your data you can display pandas uh you can write to it um you can do some simple highlights again this is all python code well what I’ll do is actually go through an app development together code by code

    So you can see a little bit of its functionality there’s some more advanced features like cash ing one of this is a core feature in streamlit uh think of it as you’re pulling data from the web right and every time your user interacts with your app you don’t want to do that

    Step all over again uh or maybe it’s a repetitive task or maybe it’s a highly um High intense in terms of compute task what you want to do is you want to cach the output of that function locally so if your arguments of your function don’t change

    And if your function body doesn’t change streamly will cash the output for those same Arguments for the same function code and you do that with like uh this decorator here streamly do cache data so yeah the values of input parameters don’t change and the code inside the function doesn’t change guess

    What you run this function you know the output 1 plus one equals to just store number two um they have this nice diagram here so anything that you can store in database you pretty much use this decorator STD cast data that could be a python object that could be a data frame

    Pandas that could be an API call anything like that and then for anything that is not store you cannot store a database think of it like an ml model or a connection you use STD streamlit do cast resource so that’s the distinction here there’s a there’s a concept of

    State um some of your applications might get really complicated and you need to maintain some kind of internal State um we won’t do it in our session in our in our Simple app here but that’s that’s something you keep in mine um maybe actually we’ll get to see

    This counter that’s a simple State how many times our app is running um connections it stream makes it very easy for you to connect the databases you can specify your database and you’re good to go in the back end uses this toml secret file where you specify all

    Your connections so you have a secret file here please don’t ignore it when you do it on GitHub push right and then yeah you have all your information there your login information and then you just say connect to my database do some query store it in data frame and then

    Displayed okay uh some additional features theming yeah you can do why U you know Dark theme and all that um fine um let’s see what else is here Pages you can do multiple Pages we’ll see that today you can have multiple Pages part of your app this is what I mean by

    Multiple pages and you can do static file serving this goes more into like web development but yeah let’s say you have an image or some content you can host it on streamlet and you can do your your um serving there and also they have really good P test

    Integration so you can do testing with with py test as well so this is summary before we actually look at code so cure Python scripts brought from top to bottom keep that in mind every time you interact with uh every time you a user opens the tab the

    Script is executed and your session starts and you can have multiple session one per user um as you as the script runs scly runs through your code and and generates content on your browser and every time you interact with the widget your script is re-executed so keep that in mind you’ll see

    That um you can do cach to avoid you know expensive functions session States if you want to persist information between reruns and you can have multiple pages so if you want to take anything away from stre L I think this seven bullet points are those they’re under documentation here

    Summary okay so I think the best way to learn is just look at a tutorial so there’s a under tutorial there’s a create an app here that we get to do uh I have this introduction to streamlit that I’ll use as my collab okay and the reason I’ll do that is

    Because ideally you you want to run this on your local python environment let’s say py charm whatever you’re running I wanted to run this on clab I’m like I don’t need this I mean who wants to install dependencies and all that can I just do it on collab I like collab um so

    There was a few things that I had to take care of and I’ll share them with you so I’ll connect here I’ll make this bigger um can you see yep so first thing first we have to streamlet um then there are a couple of things I

    Had to install just to get think of it as there’s a server that needs to run somewhere that needs to host stream LD that I need to interact with I’m not hting anything let uh let the web do it for me or let collab do it for me so I

    Had to install this local tunnel package here okay um fine I needed some content like some Python scripts from um from my Google Drive in this case I’m not going to do it but the full example is there if you want to say it I want to build it

    Piece by piece with you so you can see the full experience and then the source code would look like something like this and then to run it you would run it like this so before I do that let me go to my drive here and let me do

    Maybe this one let’s build this app first okay cool um so let me keep this on this tab and let me go to my folders here okay you see I don’t have anything so let me create a new file let’s call this demo Uber pickup do py okay so you can see

    I’m literally doing this from scratch um double click going to put it here next to my notebook cool so let’s build it slowly slowly together okay so some libraries first of all I’m just going to copy paste code for us here okay nothing exciting stream L pandas and umpai I need those

    Three um then I’m going to need um a title so this will be our first um stream lit interaction all I’ve didn’t all I’ve done is just set the title for my app I’ll save it I go to my notebook I will here add the code here and say I want my

    Demo Uber pickup. py perfect and I want this to run in parallel with stream L okay so that is running now how do I access it couple of things I need to figure out what is my IP so this is hosted somewhere okay now

    I I need to figure out how do I access this so first of all I need to figure out my own IP so this is it and second part this is where the server is running somewhere on the web you know uh first time this might not

    Work that’s what I realized and then and okay I didn’t want to wait I know this by now um I’m going to stop it I’m going to run it again this is like a heuristic that I found from interacting with this local Tunnel open again it will give me a new

    URL click on it the IP hasn’t changed right come on okay let’s try it again usually the second time is a lucky time okay okay let me stop it let’s see if it’s still running I don’t see it running that’s the problem okay I wanted my demo um host it says no the

    Port no I think the port is is a is a regular one I think reserved one wi is yeah um oh yeah Cute Stars not sure why uh um and B let’s see if um let’s see if I can connect to my Google Drive here permissions U this is one notebook that has kind of like introductory code mounted copi it ins fine just want to run it why I okay there it is woohoo

    Um so this will run okay come on Tunnel I don’t know I was running at uh uh my place I don’t know if it’s like an IP or rule I mean I can access the website let’s try it again there and this is just so that you can

    Access it through a URL without having to access it locally in your computer right yeah yeah yeah okay at least in my experience with streamlet if you just do it locally getting it running locally is super fast yeah okay maybe I do that then yeah I

    Think yeah you can run in your terminal hopefully that should probably get around yeah okay um let me actually export this then so I’ll download this Folder St running okay cool Um I yeah probably I have those and then then you do everything else install understanding basically just cult right it’s not it’s not the framework for example is there any like dependency streamlet yeah it’s more just a UI Library um I think I I see it phras like

    You know we build we put python notebooks and stuff and it’s very cool we can share python notebooks other python developers but like what’s an easy way to take a lot of that same code and just give to someone on a URL like so it’s just like nice sort of UI that

    You can use to show off code that you’re playing with e non developers play with how’s that how’s that different than uh laughing what is that website laughing laughing or hugging faces um that’s yeah that’s greater that’s the one we’re going to see after this um hold on sure

    What that’s why I wanted didn’t want to do this locally okay that’s fine let’s see if we can do it any here again um right this is why you should never look down on web Developers hard yeah good Lu buddy yeah and two is all we need and two is

    All we need I’m like I knew there was some hiccups you know but not this many all right all right all right so this is uh this is a simple one uh but I actually this is not the one that I want to run let’s keep it just in

    Case sorry buddy I’m gonna stop you uh oh cool let me run uh My Demo over here stop right just in case oh yeah I don’t know for some reason does one run this demo will pick up the pii oh pick up inad pi oh maybe I didn’t save it don’t tell me

    That oh pickups thank you thank you sir uh you go that’s what uh that was a test I’m surprised nobody saw that there it is okay no server no it was just a typle okay look at that 10 minutes to have a title okay competition one now let’s quickly

    Go to the next one so if you include a raw text like uh like this one hold on where is where am I developing here oh here I go um this will show up as so I’m saving and if I go here you see this option under

    Settings I’ll do run on Save okay and there’s another option says wi mode I’ll do that later run and save means every time the file see source file change it’ll rerun you zoom in a little bit yes yes that comes for free all right uh

    Next I’m going to keep them next to each other let’s fetch some data right so this is um so I wanted to show you this uh what is the consequence between cach data and not cash data okay so I’m going to have a daytime column here okay I’m

    Going to get some data from a CSV file I’ll read it convert it to lowercase um and then convert something to daytime right if you have a large data frame you might know this might take a while so I’m just going to save this and my app should run again but I’m

    Not displaying it so let me do something with it actually um so I’m going to create a text element that says loading data okay let me close this by now I don’t need this anymore zoomed in too much yeah um loading data load the first 10,000 records and I’ll print something

    Else it says done use I mean done without using the cache so loading data okay might take a second or two um and then based on Wi-Fi you should say you know loading done I’m going to keep this simple and actually do it like this and I’m actually going to

    Disable done okay cool I’m actually going to disable this so you get to see this running on real time there you go I’m not going to run it on Save cool so now I have to manually trigger the run so let’s say I refresh this page or I do rerun

    Again it’s not even waiting it’s saying done the code hasn’t changed your data has doesn’t change I still have the the large file you you downloaded cool um let’s add some um other features so one of them is to actually a feature to toggle showing the data are not

    Um am I not able to SC um so yeah there’s a check boox here that will enable me to rerun if you click on it it will display your pandas data frame right you can make it full screen you can download it you can search um by using this shoro data checkbox

    Cool uh so that was this one here trying to make this a little bit ising okay I don’t know if this is a monitor issue but I can’t seem to go down and doesn’t scroll I don’t know why um save okay H anyway maybe I can

    Just so I’ll copy the entire it’s not it’s not that much of a code the rest of the code so After effortless caching there you go cool so let’s see what else what other features are there so one of them you can do analysis right you can do how many pickups I had by hour so this is a Uber data set of New York City and um I

    Think this was aggregated so which hour from 023 or popular looks like 17 5m was popular um you can map them that’s another feature that you can you can do right so you can this is interactive you can zoom in looks like the bike s program right over um you can see what

    Are the pickups at a specific hour so this is 177 this 16 as you can see the wrap the app is rerunning every time I do something it will rerun it so let’s say early morning maybe 9:00 a.m. 8 a.m. um these are the pickups on the map um so yeah let

    Me maybe I can use this as my code so so that was the checkbox um the histogram to calculate the the values the bar chart and then um if I wanted a map this extremely do map and a data frame and I have a filter here for hours that you

    Can you can map it so as you can see it’s pretty pretty convenient okay let me show you another one that has a little bit few more features um this one is okay I’ll stop this running um this is the multi-page app okay no typers here yep multi page app is running okay

    Let’s run it again this we can close awesome so this this a bit more complex let me make this a little bit bigger sorry my zoom is getting in the way um there’s a main page here it says select the demo above and there are a couple of things to enable paging

    Actually so let me go back here I have to create a new folder here called pages okay and within pages I have to do um upload and let’s go to my streamlet I can have emojis in my in my scripts as long as a python script it’s

    Okay we’ll look at them so this is the first one okay zoom in yeah it looks like when I zoom in I cannot scroll um so this is a plot demo okay you’re going to see some uh I think it’s a random number generator but you’re going to see the histogram of of

    It uh the second one is a mapping a mapping demo again all this code is in the repository there okay looks like I can screen scroll here but not when I do command plus interesting oh okay I can do it perfect perfect and the third one is a data frame one

    Okay so let’s look at the first one here you see now my my app is updated uh so I have my ploting demo here so it’s a combination of ploting and animation right so it’s ploting some numbers and it’s graphing them I can rerun this will be another

    Series and again the code for this is um some random number generator here and after a while after 100 runs it just plots them cool the mapping one is is a little bit more interesting um this is using pck so this is a GEOS special data let me make

    Actually let me make this full screen woo this is the Bay Area right so um what we see here and nobody is going to find is more interesting you can see the bike rentals uh their bus stops or train stops their names and what is the flow

    Of traffic right so you need select at least one so let’s look at bike rentals um in s Francisco for a given period of time can you can zoom in right you can see this is by I don’t know some kind of hex geospatial rendering uh then let’s let’s

    Enable uh the exits ofart let me remove rentals for now and their names as well as the flow so I’m curious to see what is the flow of traffic right from station to stations this is the uh SFO um North here downtown the bridge Oakland and so forth so yeah you get to

    See the flow in a really really cool and Interactive way and the code for this is here okay perfect so um mapping demo uh this is the data for it um this pdk right this is the P deck has its own configuration so in your own Json information looks like that b

    Information stop information and part path information let you add these layers on top of each other um you have a central point of where do you want it to be focused and then a generic message please select one if you didn’t select one by default cool uh let’s look at the last

    One this is a data frame one this is really cool so I’m going to actually do this in this wide mode so you can see it see it widen a little bit my screen so this uses s right to visualize pandas right it’s from United Nations data

    Explorer data what is cool about it you can select pretty much any country you want around the world it has most of them if not all and all plotting is uh gross agricultural production not GDP right so I think that’s me measured in billion of dollars and you get to see

    Let’s say China in dark blue and United States in light blue let me remove P for now so yeah all the way from 1960 to maybe early 2000s I like this so yeah if you if you maybe pick a smaller country uh I don’t know say Italy Poland Canada

    Maybe okay comparable woohooo um you can see it um originally from here Albania and I’ve lived in gree so let’s add those probably Albania is going to be at the bottom yeah very small then Greece then Italy cool um let’s see um yeah I mean this is really cool um check it

    Out really interactive and you can maximize this let’s see you can probably get the data as well yeah so this is with Vega if you’ve used Vega and python right you can view the source this cool um you can export it and you can save it as an

    Image it’s very cool how how much how little things you needed to get a very like professional interactive demo this is the code yes so stream L pandas alter was the nice I guess drop down menu that you used um so yeah let’s see um this is the data for it um choose

    Countries uh and then based on the countries uh you normalize it I guess for a billion of dollars you select your uh what do you want your index to be looks like year is the index and the x- axis and the y- axis is the gross Agricultural Product

    You might have other fields here right you just pick one here to visualize and then this alter code so yeah add it encode it as year and color by region so yeah I mean 50 lines of code here yeah that’s what we’re talking about not not not that much

    Yeah and the menu is here yeah we can go back and forth so maybe this is your app right you can check it out cool um any question comments before I share more about the community of stream lead and you know take a quick minute break here yeah does it still have the

    Balloons function balloons function what is that uh it makes balloons show up all of your if you type happy birthday what what is the secret code for that thank okay hold okay let’s do this s. Bal function okay I’m going to add it to maybe my plotting here

    Maybe oh it’s there is that a function okay it’s exploding exploding exploding look at that look at that it was worth it okay I learned something new cool I love it very very satisfaction right yeah you work so hard for this demo coolth and then website yeah yeah that’s a good question

    So what do I do with it right now it’s like it’s running locally right so um another fun thing you can do is um let me see where’s the page for this so this is the demo page but yeah you can deploy it uh for free on their streamly Community cloud

    Look at their communities Community forum for any questioning questions Advanced features API if you want to do it you know programmatically uh but yeah it’s I’m that’s the other thing I wanted to show you um on streamlit there’s a community actually like the gallery side

    Of it this is why I wanted to so show us so you see topics here like trending llms we in apps right so LMS SLE power data visualization geography science Sports Finance so maybe maybe a cheat sheet let’s look at a cheat sheet so this is running on the cloud

    Now it’s not running on my computer and it’s rendering from the streamlets cloud so this is an actual streamlit app okay if you want to look at the code there’s a little GitHub link here and it will tell you literally um the code for it okay I just

    Want to show you a more polished version right than than than ours so than mine so you can display text display data display media columns uh tabs and so forth um yeah this is one one cool feature that if you have a GitHub actually that’s all you need you can

    Host it on the cloud platform and you can run it let me show you some other cool ones um maybe on llms since we’re doing llm right um this one is a simple one that maybe we can build um you’ll see the code is not that complicated okay it’s

    Running so all it does is first of all you need your API key here okay I guess for obvious reasons right they don’t want to be charged but then you can do like things like um there you go uh you upload a file I think oh this is

    With anthropic yeah you upload a file and then you can track with it like a very very basic rag um you can do search you can do there’s some examples with L chain and so forth so yeah let me show you the code for that just to get us inspired

    Um so yeah enter your IPI key the title caption um The Prompt and then here it’s using session states to manage the um the user content and then uh some chat completion here based on some backend uh model in this case should be 3.5 and then back and forth

    Communication with the user so yeah stream an open eye that’s that’s what we need for the first part the chat methods are all provided by stream anything that begins with let’s see I anything with s is stream L client is open your eye so client. chat is open your eye st. something is

    Streamline yeah let’s look at another example let’s see um I found some good ones there was a really good one that I think the streamlit team build um a interviewer no oh this one this one was a really cool one uh I don’t know where the code for

    This is I I’m just I really like this ad so state of LM apps of 2023 um I think this is based okay there’s a there you go but if I go there it just takes me to the generic page here there must be repository for this app okay but what I

    Like about it is it’s pretty interactive so there’s a click here tells you a little bit about it you know top models futur is multi-agent uh Vector databases chat Bots uh next one developer growth right so apps created unique developers um and adoption right so what is adoption op L chain hagging phas

    Transformers FIS from Facebook Pine con and all that so I think this is a really good data said that they explored top models we’ve seen this drop down before right uh llama Transformers hugging phase coh anthropic up AI right um holidays December I don’t know people were tired like again so many

    Topics I don’t know it’s hypothesis orchestration tools um you can do count you can do percent of usage Maybe and we’ll do that so that is pretty cool feature uh Vector databases right so Pine con chroma we8 elastic search uh Facebook one and so forth um single text input versus chat

    Okay and then some other examples uh what are some concerns obviously trust privacy cost skill um this is just a diagram of the F the fundamental architecture of an LM app about this and about methodology and somewhere here should be something about data what they used um um aggregated data only okay

    Somewhere on their app they should say exactly where you know what is this based of but I think this was really well put together right it’s like a almost like a web app that you can interact with oh you can cck close this as well uh yeah let’s look at some other

    Ones maybe data visualization right if you want to use this um I’m just going to okay this looks interesting um not sure what I’m looking at here but this looks like a monitoring maybe okay something is not running there and while that’s loading uh maybe maybe another One or maybe something from not Tech see what do we have geography maybe yeah what is this it’s still running okay location address o can I change this right is it this thing this is a new art uh art mids data I don’t know this looks cool looks like a coaster

    Yeah it’s running it’s something radius okay color theme and okay it looks like I have some presets um so maau Barcelona yeah all right look at that is that I don’t know let’s make it full screen is that represented okay is the White House right is that we’re looking at okay

    Pennsylvania all right Washington Monument cool this was cool and uh there’s some other ones okay B if you’ve seen it from the top there structure unique structures um yeah I just want to show you some other ones out there okay so that you’re inspired components that the community provides

    Know I mean these are these are examples that people have built yeah this is the person this is their code you can literally look at it um Community has Forum has a gith Hub has all kinds of um ways for you to connect uh I just like the gallery feature of it

    Yeah okay uh Barcelona yeah this how their City structure looks like from top right there their own close neighborhoods to traffic cool questions comments feedback um before take a quick break and then we’ll talk about gradio streamly yes no might use it ignoring all the technical technical issues it’s straightforward anybody online please

    Yeah let me know okay thank you all right let’s switch gears then let’s talk about gradio um let me open a new window and let me go to the learning here and under short courses um they have one on grum enroll for free remembers

    Me um so I I didn’t find a good way to do this on my laptop um I did you did I know hiking face there’s no ice there the the directory path to library got it so so a little bit about gradio gradio is a product built by Hing face

    Um haging face you see all my search here so you know the the open source Community here that you can host your models you can host you can host your leaderboards have this concept of spaces where you can we can publish things yeah so models data sets forums documentation

    Um so where where stream is more like a python toolkit you can develop anything in Python stream will run it for you hugging face is like okay let’s really focus on anything that we in hugging phase deal with so anything about models anything about data sets more like

    Machine learning kind of kind of approach um it’s not as fancy as stream lead in terms of hey give me a visualization of bike rentals in DC no can’t do that does it have balloons have what does it have balloons balloons no doesn’t have balloons no if

    That is your check no I’m sorry but it has some nice features I get to see give it instructions you can give it instructions oh yeah I like creativity in this room is off the chart keep that thought it might have balloons it might balloons will be uh on the menu okay I’m

    Going to zoom in here okay so I I’ll run it from the course if you don’t mind okay I didn’t find a way I was saying to run this locally um they have this um backand feature here o environment right so you can look at their API keys if you want

    Uh but from our perspective what we’re going to do is use this hogging phas API summary base and if you take the course that’s basically the short story is you don’t need a a billion parameter model to do something very simple as like a summarization task that’s been studied

    In NLP for for many years you don’t need to building parameters for that you need like a a few million you know and it will do a decent job why is that important because it’s it’s not as expensive and it doesn’t take forever to run not forever but it’s very very fast

    You know so yeah uh that’s their selling point that you don’t need you know anthropic or you don’t need open the eye or or claw and all that to do a summary of a of a two paragraph page you can you can have your own open source I mean you

    Can use an open source model from hacking phas it’s very small you can probably fit it in your uh in your in your memory definitely and it’s it’s yours you can you can run it as you wish so this is one of them this uh API summary base is

    Is one of them so we’re going to do with that is let’s see how do we use it and this is how you run it locally this is the the difference so if you run it locally from Transformers is a hugging phase Library you would import Pipeline and if you do summarization you

    Can you can specify the model in this case they using this this steb CNN 12 six right so absolutely where it say model equal yeah you needer that’s theer no h you mean just add an S prepend an S to no okay is that what I mean I mean

    For me this worked was didn’t to run it locally oh locally you mean okay I didn’t even try locally got it got it okay so this is run we have a a summary here text right the tower is 324 meters about the height of 81 story building the tot of

    Structure in Paris so he’s talking about the Eiffel Tower it’s Sur past the Washington Monument How dare they to become the tallest man instructure in the world a title held for 41 years until the criser building in New York City was finished okayer and then it was a I think it was

    Another building that surpassed it I was I was curious who that building is do you have any idea which is the tallest building right now in France taller than the in France okay fine um not sure this is a r we can ask the llm you know so all

    We’re doing here is calling this get completion meth and we’re using this um this Ste B CNN 126 okay which is here um you can tell a little bit more about it yeah 200 million parameters okay and it will give us a summary so the tower is this feet tall about the

    Same height it’s the tallest structure in Paris the second tallest in France after this and I’m like what is this any idea get ready to be surprised it’s a bridge but look how tall it is yeah that’s why it’s taller than the but you can drive on the

    Brdge cool yeah cool right now we haven’t used gradio though right now we just interacted with hiking face we asked it a question to summarize it summed for us cool how do use gradio well we need to install it and then we need to import it here um um this is

    Just wrapping the the previous call in a function uh if you have any Windows let’s just close them now and this is gradio anything that begins with gr gradio you have an interface it takes as input a function that we need to call in this case

    Summarize and what do we these are key Concepts in gradio what is our input and what is our output in this case is text and text later you’re going to see text and image when you want to do image generation or the other way image and

    Text you put an image it gives you a description of what is in the image um and then launch it so hold your breath this is running it on deep learning AI Jupiter notebook back in okay exciting something is spinning woohoo look at that we got some buttons

    So what are we doing with it right so we have a summarize so let’s find some text summarize this is a very short text summarize it for me all right exactly this is what I noticed guys I’m like I’m like hey yeah but I lost the sales Peds you

    Know nobody’s going to buy this this is a very short text from an author of a short book is the first time it’s starting hallucinating you know we Happ to reveal the book for only $199 what okay I got scared to be honest by this you know the less you put yeah the

    Weirdest things you get okay let’s go to Wikipedia that was recommended by the course instructor pick our favorite uh topic of the day I found with three before chat if you put in just like one letter or like one word it would often give you paragraphs it would give you the

    Crazi there so little to work off of that it just you didn’t know better yeah I didn’t have reinforcement learning to not give you a crazy output okay I’m just going to talk about Winter Olympics okay hopefully it’s positive no world I no back space walk sounds positive please

    Be positive okay I don’t know about this so I’m just going to copy pasted okay uh disclaimer YouTube whatever sorry about this this is negative I lit have no idea what this is about I submit so we’re talking about a walkable sculpture guys in South Korea okay by

    German designer hii thank you and ulri okay okay soft opening November 2021 we’re good I’ll take it it’s good yeah okay I don’t know I find this fascinating like if I start entering something very simple hello I’m afraid I hit some it hello hello is a weekly it’s like what

    Is this the data where it’s coming from oh my God yeah yeah it tells you the you right where he training from who are you okay all right it likes I report.com so yeah so yeah so I can summarize for you but give it some you know give it some push

    Cool um what else can we do uh the other thing you can do is this this uh share true so if you host it locally actually if you if you run it locally and if you do share true it will generate a URL for you then you can give to your

    Friends and scare them and and scare the heck out of them I’m saying you they’ll host it for you and you have URL and the URL you open it will be this UI or but you poost it yourself for three days on your on your local machine if you run it

    Locally okay I did and I got my teenager to try it it was like a huge win awesome thank you Melissa thank you okay um all right this was fine summarization we can do what else can we do so there’s another concept of named entity recognition right any so what does that do

    So let’s say you have a large Corpus you want to analyze it okay where are the people where are the places the building or who are the whatever Concepts right and this ner birth based ner I think only has four or five different categories so if it’s a person with a

    Confidence score if it’s an org and then some base um beginning of an entity intermediate entity intermediate entity a lot of a lot of Json or if it’s a location we can make it pretty right so we can create our own new um new n function here okay we want our

    Input to be text and our output will be entities so this is the back end that radio offers it gives you an entities output okay we can do something right hey we don’t want the generic input output we can actually label our I’m going to run this take a second

    We can label our input and we can label our output look at that we can have a title we can have a description uh if you noticed before there was a flag here I didn’t get to use it see this flag you can disable that I don’t know why you would do that

    Um so let’s see how this looks like on on gr right so sure my name is Andre and I live in California that’s Andre Okay so this is what it would look like right so Andrew is a person California is a player okay you do this now and you get this

    Long uh output and you’re like what is this and these are actually tokens so hu is a token this part is a token this is a token this is a token okay fine we can we can do better than that some code to combine all the tokens that begin with b

    And have I in the intermediary step this was like I’m like why why why you have to write your wrong code just just make it in the back and and give it to us so let’s see after some uh coding okay my Andre Andrew okay fine so person org

    Location person location or okay can you say like and I was going on I what anything else and you like Hing face or extremely I mean I think was it one word no it was one and you thank M ah what happened I broke it out of tokens

    Oh there you go it takes two clicks all right we’re good so yeah person December it missed the date usually see 2023 no oh okay so then if you look at the maybe the documentation for ner let’s see where is it and what was the name of the model dis still

    Bird yeah this one if you go to their documentation I don’t think they do dates then um yeah there you go that’s what they do outside name miscellane it should tell me at least miscellaneous right person org location that’s it a come on okay let’s start yeah it only does those three or

    Four categories cool so this was on text okay questions comments on this going to switch to images now right let this start anybody on Zoom comments close this and import the same thing so this is image to text this for me did not work even on the course

    Material I don’t know if you tried it what model it using um no it’s using Salesforce blip image captioning base this didn’t work for me um so this is um one of Salesforce so the way it works is you have an image you pass through an encoder you do all this complicated you

    Know uh math here and you get your your your output right so you give it pairs of images and captions and you train this network given a new image to give you the caption so what is dog wearing Paar glasses okay woohoo yeah okay let’s try this um so we’re

    Going to use this we have a URL here of a cute dog but doesn’t work damn it I mean this blip image I don’t know it’s not hosted properly if you look at it uh or I don’t know they use some kind of reverse proxy I was trying to troubleshoot this

    Actually uh yeah they use some kind of reverse proxy that for some reason doesn’t work so yeah it doesn’t do image to text okay okay fine um one concept that if you want to do this over API calls you have to convert them to base 64 that’s that’s one thing you can take

    Away and you can add some examples and these examples are locally hosted so if you like to see them just go here and you get to see The Notebook that you’re running as well as the images so there’s a bird um you get to see it yeah you can

    Upload your own image or you can do the the bird but I get this error that it’s okay I guess if you do it locally you can you can trably shoot it all right let’s go to the next one next one is running fine so that was captioning now this is image generation

    So text to image okay um let’s run this so this is a different base okay and I’ll tell you what the model is this is from stable diffusion yeah so stable diffusion so you give it a prompt I’ll get ready to see your balloons and it will generate an image

    This takes what like a 10 seconds I guess 15 seconds for me yeah I don’t know every time I look at IM AI generated content I’m like oh dear God please I don’t know I don’t know about you like what is this peace peace peace rerun

    Rerun what the dogs and cats guys yeah I generated not as cute as the internet the there’s an extra yeah extra finger extra yeah don’t pay attention to details okay just like casually look at it and then look away don’t don’t put this on your birthday card okay please be cute please be

    Cute prompt engineering it’s super cute dog I’ll I’ll try you tell me I’ll try cute fluffy dog I actually did oh my God I don’t know I don’t know okay fine I think there’s an extra leg extra leg this is the yeah un improved version yeah I will

    Say I did play with the adjective I put like an ugly dog honestly there was no no distinction I couldn’t tell it you’re couldn’t tell it okay yeah something like hands if you put in like like a wrong hand or something if you said what you didn’t want sometimes it would

    Actually give you a better hand figuring out oh okay negative those was a negative problem you’ll say it you’ll say it here okay so now that was the API call right now we get to build an an app using radio that does pretty much the

    Same so it has input now is a text box the output is an image title description so forth so title description your prompt and your results okay um I don’t know he the instructor he lives in Vienna so he mentioned this I wasn’t super super interested in that

    Um um a winter day in Washington DC maybe I just wanted to have something um very generic right you talking about yeah and whoa okay I don’t know does this even exist though where is this that’s what I’m thinking about right this might be Pennsylvania but there’s traffic there no trees

    Uh yeah okay okay I’ll take it I I’ll take ideas at this point prompts yeah you tell me I got pretty decent results from one putting in like a winter day in a northern northern climate you would get snow and put I put in like a winter day in

    Bangkok very tropical oh I see okay okay in Barcelona is that what you’re saying or Bangkok I don’t know Bangkok so I don’t know I’ve never okay they wear scars San Diego May dieg Singapore I don’t think they have have you been there can you tell us if it’s

    True I need a winter tell me how how you want you want the prompt to be a bit more Taylor okay I’m curious now winter is in Singapore according to uh stable diffusion all right Melissa does it look right know the sky you know the skyline this is a classic building though remember

    This looks like a hey George yeah uh could you try uh so I’ve been trying something with logos as well so something like maybe if we uh try um you know a restaurant logo just see how it handles text or how it handles shapes as well okay okay let me try that

    Yeah Melissa is this Singapore no you didn’t go to this park you didn’t stay in this building okay like that that thing there’s artificial Forest that’s what it is okay okay so Jonathan you’re saying something about a logo yeah logo it doesn’t do well stable diffusion so which restaurant which restaurant you

    Do not like at all McDonald’s McDonald’s oh my God I feel bad for them maybe we could do like a storefront um the prom the um a McDonald’s storefront um will run any with visible logo I guess Dolly can’t do Copyrighted Wonder okay yeah the word McDonald might Set It Off yeah I me I don’t know all right look at that how many M you can get you know one two three arcs yeah &em literally a real window there’s a real window hold I’m trying like yeah just a bunch

    Of doesn’t really like P how about half half Get okay is that what you mean inut welcome all right we got some text okay yeah to be honest it did better than I thought it would like represents at least I think on the bottom is correct right correct correct Furniture though so like uh I think that’s the same type of

    Machines any other requests hey Robert could you look at the chat for mine uh sure what do you have Fisher opening in gavic I don’t know enough about that phrase to know whether it’s advisable for me to copy and paste that into here like a lava fish that’s what was

    That um by Fisher I mean lava fishing here it’s like it’s a real possibility in like the coming weeks oh is that Iceland yeah okay place hope it’s something that’s all right all right there’s there’s some stuff is it a cave or I don’t know that

    Right oh it looks like a I don’t know what this is there’s some water coming from underwater almost look like a sinkhole it’s a it’s a parallel universe where yeah the water I don’t know this is ground this is water ground so gavic I

    Think is a town and I think it’s like a GE geological thing that’s happening in that town oh beautiful town oh has Hot Springs okay that’s that’s the blue lagon which is like yeah some kilm like to the north of the town okay cool all right let’s look at the

    Next one um oh this was an interesting one with more advanced interface uh this is where you get the concept of this negative prompt so build something but pay attention and avoid the negative prompt okay and you can have a little bit more control so maybe maybe your model has

    Some more fine tuning some sliders you know some hyper parameters um you can expose those in your UI so you see now we have your prompt your negative prompt you have your steps think of it as like the more steps the more time it will take and probably the

    Higher quality the size of your image with height so what is the example I use in the course I don’t remember um beautiful say in Spring oh low quality right they use low quality Give me meaning avoid low quality and give me high quality okay and you can specify the size the

    Way whoa whoa I don’t know what’s happening here can you try the opposite try high quality the electric skateboards what is this yeah I don’t have no idea they’re cherry blossoms cherry blossom I got it I like that thank you Alissa so you want high quality yeah I’m curious what

    Happens as if we haven’t desecrated you know what is this okay oh all right it’s better no that’s honestly I think it’s high different perspective uh what else we want to avoid avoid avoid Cherry BL oh you’re really taking a f out this come on if you’re looking for dark you know

    You can just go to the previous model and say hello okay don’t do cherry blossom oh look at that it invented not DC not what are you talking about this is DC 100% this is the capital with the Washington Monument you know I don’t know if it’s on top of

    It or next to it but that is really disturbing quick question how does uh how does uh fingers work with stable diffusion can we uh can we adjust it enough so fingers can show up this just uh tosing it out there for a while so I don’t know okay okay

    Maybe I don’t know okay okay let me Max it out is that what you’re saying so more steps uh more guidance okay please give me five fingers yeah it doesn’t work I get it crashing whenever I tried to increase steps oh is that what happened yeah okay

    Uh let me decrease oh well it’s all good I don’t know hold I’m curious now all right next topic blocks uh you can have rows you can have columns right so let’s check this out real quick so you can really specify where the pieces in your UI are going to

    Be so in this case I have a row for my prompt here I’ll look at the code um so I have the first row actually this is before my row I have my text box for my label input my prompt and then a second row is this that row has one

    Single column that has all of them and then another column for the results right so first row is my input and my second row is all this entire content and my second row is split into First Column and second column so this is just um beautiful days M and

    Uh yeah I I’ve played around with it and I think you have to give like 50 or more steps to not have like demonic looking people yeah um yeah so definitely they probably OB takes more time yeah yeah yeah W when get issues yeah cool and the

    Last step here is this accordion maybe you have too many parameters you don’t want to show them maybe you want to show them to your friends you hiire them like we saw in scam L you have like a drop down um so here you just want to show them the

    Prompt a cute cat I’m sorry about this oh doesn’t run cool I’m okay with that I don’t know why but uh no they are okay please be cute please be C okay that’s it I’m good I’m good it looks like a cat I’m afraid of scroll oh it’s

    A cute cat look at that I’m okay with that so maybe cats are better than dogs is that what’s going on ah internet is so biased cool and let’s go to the last one here this was like a game he the course content recommended he’s like oh maybe

    You can combine image generation and text captioning together the cap doesn’t work yeah caption doesn’t work so for me this demo didn’t work but the idea was uh you give it an image it gives your caption and then you generate another image and I guess you compare I

    Guess or you have fun playing this game fine and the last one was um the chat version of it right so yeah so this was like a larger LM so all we’ve seen right now is smaller models this was like the bigger one and let’s see what this does um so this is

    The Falcon 40 billion instruct right so it’s one of the high performing open source models that you can you can use on your own all right has math been invented or discovered this was a good question right if you take math courses this is

    You do all the math at the end of the day this is important question invented okay okay language discovered his language discovered it’s invented it’s invented well math has been both invented and discovered it’s a human invention in the sense that it’s a system of rules and Concepts yeah it’s

    Also discover in the sense that it’s a fundamental aspect of the universe well well the way we talk about the universe or itself okay Um so all we’re doing here is basically exposing that um model here Falon 40 billion in an II right so you have your prompt what is perfect St Inc in Spring please say Tre Blossom please okay good all right looks like we might have

    A like a let’s see in our code maybe a completion yeah here let make it four for yeah but I think you had 20 tokens in the actual interface that’s why it stopped oh I see like you sp down the slider okay I found it interesting that it interprets perfect day as

    Weather as opposed to like Congress actually passing yeah oh yes visualize it come on this is a text this is an instruct this is a text based model yeah I had a nice day in DC guys I went to the National Mall and sou Washington okay the linol memorial and the capital

    Building I visited the Smith Sonia National Museum of Natural History that’s a good one Aon Space Museum that’s a good one how would DC have been designed differently if it was done by scientist oh okay I like the Deep questions okay um let’s ask the chat Bo maybe that

    I’m intrigued by that answer it’s not this that’s an instruct model yeah that’s more of like a completion like it didn’t give you an answer it gave you like a continuation it was a story yeah interesting that it would it’s not really following the typical instructional format so now oh yeah yeah

    That’s this more you had a little bit of the chatboard functionality so it keeps track of your interactions right it adds them as context to each prompt and it’s you keep interacting with it until I guess you run out of memory um there’s so many two days in thec okay National

    Zoo National Mall picnic tour of the city local market new restaurant what do you recommend for uh visitor that likes I don’t know Sushi do we have Sid I think we do yeah of course I’ve been here it’s a good one okay I don’t know yeah we can change the

    Topic I haven’t been here so I don’t know this yeah the exist come on man what’s the fun of that go back to the math question huh invented discover somebody else named I trust beans no beans multiple it’s true regardless of who discovered it yeah very good fundamental

    Principle would still hold true magical yeah cool um streaming it’s okay um I think that’s mainly it I just wanted to show us what are some capabilities of gradio again gradio itself has its own m yeah gred out app um if you want to look at some examples let’s see are there any

    Examples here playground maybe oh this is actual playground uh filter record transport Matrix fine um no there should be like a immunity maybe maybe guides okay um quick start maybe quick start cheah in the water oh man their proms are I mean their output is cool which model is this

    Okay so yeah that’s what I wanted to show to share with us I think um we covered two ideas on how to create um a nice UI going stop sharing here but um that’s what I wanted to share um as a reminder before we wrap we have this

    Community projects if you want to add your name here ad them uh later this week I’ll I’ll start creating some uh slack channels for each project like if I see more than two people I’ll just create a channel there and then we can interact together in terms of uh how to

    We tackle them so yeah it should be fun cool thank you thank you for patience we did it thank you for joining us online I’ll stop recording here and leave the floor open for

    Leave A Reply