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