thesourmango commited on
Commit
39d46c0
·
1 Parent(s): 49a0b08

Added JS API implementation

Browse files
Files changed (2) hide show
  1. app.py +2 -2
  2. client.js +7 -0
app.py CHANGED
@@ -1,8 +1,8 @@
1
  from gradio_client import Client
2
 
3
- client = Client("https://bistromd-mistral--zr2ft.hf.space/")
4
  result = client.predict(
5
- "Howdy!", # str in 'Message' Textbox component
6
  0.9, # int | float (numeric value between 0.0 and 1.0) in 'Temperature' Slider component
7
  256, # int | float (numeric value between 0 and 1048) in 'Max new tokens' Slider component
8
  0.9, # int | float (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
 
1
  from gradio_client import Client
2
 
3
+ client = Client("https://huggingface.co/spaces/bistromd/Mistral")
4
  result = client.predict(
5
+ "Hello, tell me a short story", # str in 'Message' Textbox component
6
  0.9, # int | float (numeric value between 0.0 and 1.0) in 'Temperature' Slider component
7
  256, # int | float (numeric value between 0 and 1048) in 'Max new tokens' Slider component
8
  0.9, # int | float (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
client.js ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ // Requirements: npm i @gradio/client
2
+ // This should return the reply from the mistral model API
3
+ // Source: https://www.gradio.app/guides/getting-started-with-the-js-client
4
+ import { client } from "@gradio/client";
5
+ const app = await client("https://bistromd-mistral--zr2ft.hf.space/");
6
+ const result = await app.predict("/chat", "Howdy!", 0.9, 256, 0.9, 1.2 );
7
+ console.log(result.data);