Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
|
|
|
| 1 |
+
# import gradio as gr
|
| 2 |
+
|
| 3 |
+
# def greet(name):
|
| 4 |
+
# return "Hello " + name + "!!"
|
| 5 |
+
|
| 6 |
+
# iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 7 |
+
# iface.launch()
|
| 8 |
import gradio as gr
|
| 9 |
+
import requests
|
| 10 |
+
|
| 11 |
+
# Create a Gradio app.
|
| 12 |
+
app = gr.Interface(fn=my_function, inputs=['text'], outputs=['output'])
|
| 13 |
+
|
| 14 |
+
# Get the URL of the Gradio app.
|
| 15 |
+
url = app.launch()
|
| 16 |
|
| 17 |
+
# Make a POST request to the URL of the Gradio app.
|
| 18 |
+
data = {'text': 'This is a test.'}
|
| 19 |
+
response = requests.post(url, data=data)
|
| 20 |
|
| 21 |
+
# The response to the POST request will be the output of the Gradio app.
|
| 22 |
+
output = response.json()['output']
|