| import gradio as gr | |
| # def greet(name): | |
| # return "Hello " + name + "!" | |
| # demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox") | |
| # Define the API URL | |
| api_url = "https://jsonplaceholder.typicode.com/guides" | |
| # Fetch the data from the API | |
| data = gr.get(api_url) | |
| # Create a table with the fetched data | |
| table = gr.table(data, headers=["ID", "Name", "Email"]) | |
| # Create a Gradio interface with the table | |
| interface = gr.Interface(fn=table, inputs=None, outputs=table) | |
| interface.launch() | |
| demo.launch(share=True) # Share your demo with just 1 extra parameter ๐ | |