Spaces:
Sleeping
Sleeping
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) |