siya02 commited on
Commit
e2e999a
·
1 Parent(s): b449132

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -4
app.py CHANGED
@@ -25,12 +25,18 @@ import gradio as gr
25
  def my_function(name):
26
  return "Hello " + name + "!!"
27
 
28
- # Create a Gradio app.
29
- app = gr.Interface(fn=my_function, inputs=['text'], outputs=['text'])
30
 
31
- # Set the `allow_origin` parameter to `*`.
32
- app.allow_origin = '*'
33
 
34
  # Launch the Gradio app.
35
  app.launch()
36
 
 
 
 
 
 
 
 
 
 
25
  def my_function(name):
26
  return "Hello " + name + "!!"
27
 
 
 
28
 
29
+ # Create a Gradio app.
30
+ app = gr.Interface(fn=my_function, inputs=['text'], outputs=['text'], allow_external_requests=True)
31
 
32
  # Launch the Gradio app.
33
  app.launch()
34
 
35
+ # Make a POST request to the URL of the Gradio app.
36
+ data = {'text': 'This is a test.'}
37
+ response = requests.post(app.url, data=data)
38
+
39
+ # The response to the POST request will be the output of the Gradio app.
40
+ output = response.json()['output']
41
+
42
+