versae commited on
Commit
462cb8b
1 Parent(s): 65f1a50

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -12
app.py CHANGED
@@ -36,6 +36,25 @@ with gr.Blocks() as blk:
36
  o = gr.Textbox()
37
  b.click(hallo, inputs=[t], outputs=[o])
38
  a.click(hadet, inputs=[t], outputs=[o])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
39
 
40
  ifa = gr.Interface(lambda: None, inputs=[t], outputs=[o])
41
 
@@ -44,15 +63,4 @@ blk.output_components = ifa.output_components
44
  blk.examples = None
45
  blk.predict_durations = []
46
 
47
- bapp = blk.launch()
48
-
49
- print("""
50
- import requests
51
-
52
- requests.post(
53
- url="http://127.0.0.1:7861/api/predict/", json={"data": ["Jessie"], "fn_index": 0}
54
- ).json()
55
- requests.post(
56
- url="http://127.0.0.1:7861/api/predict/", json={"data": ["Jessie"], "fn_index": 1}
57
- ).json()
58
- """)
36
  o = gr.Textbox()
37
  b.click(hallo, inputs=[t], outputs=[o])
38
  a.click(hadet, inputs=[t], outputs=[o])
39
+ gr.Markdown("""
40
+ ## API
41
+ ```python
42
+ import requests
43
+
44
+ requests.post(
45
+ url="https://hf.space/embed/versae/gradio-blocks-rest-api/+/api/predict/", json={"data": ["Jessie"], "fn_index": 0}
46
+ ).json()
47
+ requests.post(
48
+ url="https://hf.space/embed/versae/gradio-blocks-rest-api/+/api/predict/", json={"data": ["Jessie"], "fn_index": 1}
49
+ ).json()
50
+ ```
51
+
52
+ Or using cURL
53
+
54
+ ```
55
+ $ curl -X POST https://hf.space/embed/versae/gradio-blocks-rest-api/+/api/predict/ -H 'Content-Type: application/json' -d '{"data": ["Jessie"], "fn_index": 0}'
56
+ $ curl -X POST https://hf.space/embed/versae/gradio-blocks-rest-api/+/api/predict/ -H 'Content-Type: application/json' -d '{"data": ["Jessie"], "fn_index": 1}'
57
+ ```""")
58
 
59
  ifa = gr.Interface(lambda: None, inputs=[t], outputs=[o])
60
 
63
  blk.examples = None
64
  blk.predict_durations = []
65
 
66
+ bapp = blk.launch()