CoolFace
Apppublic

bistromd/MistralAPI

sourceHugging Faceapache-2.0updated 3y agoView on Hugging Face
0likes
App README

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