anvil.server.callable
Browse files- .ipynb_checkpoints/app-checkpoint.py +12 -0
- app.py +1 -1
.ipynb_checkpoints/app-checkpoint.py
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import anvil.server
|
| 3 |
+
|
| 4 |
+
anvil.server.connect('55MH4EBKM22EP4E6D5T6CVSL-VGO5X4SM6JEXGJVT')
|
| 5 |
+
|
| 6 |
+
@anvil.server.callable
|
| 7 |
+
def greet(name):
|
| 8 |
+
retval=anvil.server.call('server_function',name)
|
| 9 |
+
return "Hello " + retval + "!!"
|
| 10 |
+
|
| 11 |
+
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
|
| 12 |
+
iface.launch()
|
app.py
CHANGED
|
@@ -2,8 +2,8 @@ import gradio as gr
|
|
| 2 |
import anvil.server
|
| 3 |
|
| 4 |
anvil.server.connect('55MH4EBKM22EP4E6D5T6CVSL-VGO5X4SM6JEXGJVT')
|
| 5 |
-
#define server function
|
| 6 |
|
|
|
|
| 7 |
def greet(name):
|
| 8 |
retval=anvil.server.call('server_function',name)
|
| 9 |
return "Hello " + retval + "!!"
|
|
|
|
| 2 |
import anvil.server
|
| 3 |
|
| 4 |
anvil.server.connect('55MH4EBKM22EP4E6D5T6CVSL-VGO5X4SM6JEXGJVT')
|
|
|
|
| 5 |
|
| 6 |
+
@anvil.server.callable
|
| 7 |
def greet(name):
|
| 8 |
retval=anvil.server.call('server_function',name)
|
| 9 |
return "Hello " + retval + "!!"
|