Gradio (from [[HuggingFace]]) lets you build and share machine learning applications, but is best known as a UI wrapper for LLM applications. For LLM apps often all you need is a text box for input and text box for output. Gradio makes this super simple. It also allows you to quickly share demos with your colleagues with its unique sharing feature. ```python import gradio as gr def greet(name): return "Hello " + name + "!" demo = gr.Interface(fn=greet, inputs="text", outputs="text) demo.launch() ``` Pass `share=True` to `launch` to create a public URL where others can access your application. Note that your machine will be used to run the code; gradio is not spinning up a VM. This share link expires in 72 hours. For free permanent hosting and GPU upgrades, run `gradio deploy` from the terminal in the working directory to deploy to Hugging Face Spaces ([https://huggingface.co/spaces](https://huggingface.co/spaces)). For basic chatbots, Gradio expects a function `chat(message, history)` where `message` is the prompt to use and `history` is the past conversation in the model's required format. ```python def chat(message, history): messages = [{"role": "system", "content": system_message}] + history + [{"role": "user", "content": message}] stream = openai.chat.completions.create( model=MODEL, messages=messages, stream=True ) response = "" for chunk in stream: response += chunk.choices[0].delta.content or '' yield response ```