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