Spaces:
Runtime error
Runtime error
Create calling_script.md
Browse files- calling_script.md +20 -0
calling_script.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Python
|
| 2 |
+
|
| 3 |
+
from gradio_client import Client
|
| 4 |
+
|
| 5 |
+
client = Client("tensorgirl/Restaurant-Chatbot")
|
| 6 |
+
result = client.predict(
|
| 7 |
+
"Hello!!", # str in 'Message' Textbox component
|
| 8 |
+
api_name="/chat"
|
| 9 |
+
)
|
| 10 |
+
print(result)
|
| 11 |
+
|
| 12 |
+
## Javascript
|
| 13 |
+
import { client } from "@gradio/client";
|
| 14 |
+
|
| 15 |
+
const app = await client("tensorgirl/Restaurant-Chatbot");
|
| 16 |
+
const result = await app.predict("/chat", [
|
| 17 |
+
"Hello!!", // string in 'Message' Textbox component
|
| 18 |
+
]);
|
| 19 |
+
|
| 20 |
+
console.log(result.data);
|