
Gradio Has a Free API — Build ML Demos in 5 Lines of Python
Gradio: The Fastest Way to Share ML Models Gradio by Hugging Face lets you build interactive ML demos with minimal code. Upload an image, get predictions. Enter text, get translations. Any model, any interface, 5 lines of code. Why Gradio 5 lines to create a web interface for any model Auto-generated API — every Gradio app gets a REST API Share links — public URL in one flag Hugging Face Spaces — free hosting 20+ input/output types — image, audio, video, text, file The Free API Create an Interface import gradio as gr def greet ( name , intensity ): return " Hello, " + name + " ! " * int ( intensity ) demo = gr . Interface ( fn = greet , inputs = [ " text " , gr . Slider ( value = 1 , minimum = 1 , maximum = 10 )], outputs = " text " ) demo . launch () # Starts web server + API Auto-Generated REST API Every Gradio app automatically gets an API: # Call the API curl -X POST http://localhost:7860/api/predict \ -H "Content-Type: application/json" \ -d "{ \" data \" : [ \" World \" , 3]}" #
Continue reading on Dev.to Python
Opens in a new tab


