Spaces:
Sleeping
Sleeping
File size: 986 Bytes
27c443b e706bd1 27c443b e706bd1 27c443b |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
import gradio as gr
def my_inference_function(name):
return "Hello " + name + "!"
block = gr.Blocks(css=".gradio-container {background-color: lightgray}")
with block:
with gr.Row():
gr.Markdown("<h3><center>REST API Test</center></h3>")
with gr.Row():
message = gr.Textbox(
label="What's your question?",
placeholder="What's the answer to life, the universe, and everything?",
lines=4,
)
submit = gr.Button(value="Send", variant="secondary", api_name="askme")
output = gr.Textbox(label="Answer", lines=4, readonly=True)
gr.Examples(
examples=[
"What are agents?",
"How do I summarize a long document?",
"What types of memory exist?",
],
inputs=message,
)
gr.HTML(
"<center>Powered by </center>"
)
submit.click(my_inference_function, inputs=[message], outputs=[output])
block.launch(debug=True) |