FlipperDudeManGuy commited on
Commit
27c443b
·
1 Parent(s): e706bd1

Add application file

Browse files
Files changed (1) hide show
  1. app.py +32 -14
app.py CHANGED
@@ -1,18 +1,36 @@
1
- import gradio
2
 
3
  def my_inference_function(name):
4
  return "Hello " + name + "!"
 
 
5
 
6
- gradio_interface = gradio.Interface(
7
- fn=my_inference_function,
8
- inputs="text",
9
- outputs="text",
10
- examples=[
11
- ["Jill"],
12
- ["Sam"]
13
- ],
14
- title="REST API Demo",
15
- description="This is a demo of how to build an AI powered REST API with Gradio and Huggingface Spaces See the **Use via API** link at the bottom of this page.",
16
- article="© Infinity Intel"
17
- )
18
- gradio_interface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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)