import gradio as gr | |
import requests | |
def quote(): | |
res = requests.get("https://api.quotable.io/random").json() | |
return f'<h1> {res["content"]}</h1> <h3>{res["author"]}</h3>' | |
# demo = gr.Interface(fn=greet, inputs="text", outputs="text") | |
with gr.Blocks() as demo: | |
# text = gr.Textbox(label="Quote") | |
btn = gr.Button(value="Random quote") | |
html = gr.Markdown() | |
btn.click(quote, inputs=[], outputs=[html]) | |
demo.launch() | |