MistralAPI / README.md
thesourmango
Added JS deployment guide
a79d5b7
---
title: MistralAPI
emoji: 📉
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 3.47.1
app_file: app.py
pinned: false
license: apache-2.0
---
## This is the API endpoint implementation of the Mistral interface
The Mistral GUI is located on https://huggingface.co/spaces/bistromd/Mistral
The API endpoint is on https://bistromd-mistral--t49mg.hf.space/
### Requirements for deployment using Python
I use the gradio_client Python library or the @gradio/client Javascript package to query the demo via API.
```
$ pip install gradio_client
```
### Named Endpoints
*api_name: /chat*
```
from gradio_client import Client
client = Client("https://bistromd-mistral--t49mg.hf.space/")
result = client.predict(
"Howdy!", # str in 'Message' Textbox component
0, # int | float (numeric value between 0.0 and 1.0) in 'Temperature' Slider component
0, # int | float (numeric value between 0 and 1048) in 'Max new tokens' Slider component
0, # int | float (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
1, # int | float (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
api_name="/chat"
)
print(result)
```
## Return Type(s)
str representing output in 'Message' Textbox component
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
## Requirements for deployment using JS
```
$ npm i -D @gradio/client
```
### Named Endpoints
api_name: /chat
```
import { client } from "@gradio/client";
const app = await client("https://bistromd-mistral--zr2ft.hf.space/");
const result = await app.predict("/chat", [
"Howdy!", // string in 'Message' Textbox component
0, // number (numeric value between 0.0 and 1.0) in 'Temperature' Slider component
0, // number (numeric value between 0 and 1048) in 'Max new tokens' Slider component
0, // number (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
1, // number (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
]);
console.log(result.data);
```
### Return Type(s)
string representing output in 'Message' Textbox component