thesourmango commited on
Commit
1f9b19e
·
1 Parent(s): f43f827

Added Mistral endpoint

Browse files
Files changed (2) hide show
  1. README.md +35 -0
  2. app.py +11 -6
README.md CHANGED
@@ -10,4 +10,39 @@ pinned: false
10
  license: apache-2.0
11
  ---
12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
10
  license: apache-2.0
11
  ---
12
 
13
+ ## This is the API endpoint implementation of the Mistral interface
14
+ The Mistral GUI is located on https://huggingface.co/spaces/bistromd/Mistral
15
+
16
+ The API endpoint is on https://bistromd-mistral--t49mg.hf.space/
17
+
18
+ ### Requirements for deployment
19
+ I use the gradio_client Python library or the @gradio/client Javascript package to query the demo via API.
20
+
21
+ ```
22
+ $ pip install gradio_client
23
+ ```
24
+
25
+ ### Named Endpoints
26
+ *api_name: /chat*
27
+
28
+ ```
29
+ from gradio_client import Client
30
+
31
+ client = Client("https://bistromd-mistral--t49mg.hf.space/")
32
+ result = client.predict(
33
+ "Howdy!", # str in 'Message' Textbox component
34
+ 0, # int | float (numeric value between 0.0 and 1.0) in 'Temperature' Slider component
35
+ 0, # int | float (numeric value between 0 and 1048) in 'Max new tokens' Slider component
36
+ 0, # int | float (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
37
+ 1, # int | float (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
38
+ api_name="/chat"
39
+ )
40
+ print(result)
41
+ ```
42
+
43
+ ## Return Type(s)
44
+ str representing output in 'Message' Textbox component
45
+
46
+
47
+
48
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py CHANGED
@@ -1,7 +1,12 @@
1
- import gradio as gr
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
-
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
1
+ from gradio_client import Client
2
 
3
+ client = Client("https://bistromd-mistral--t49mg.hf.space/")
4
+ result = client.predict(
5
+ "Howdy!", # str in 'Message' Textbox component
6
+ 0, # int | float (numeric value between 0.0 and 1.0) in 'Temperature' Slider component
7
+ 0, # int | float (numeric value between 0 and 1048) in 'Max new tokens' Slider component
8
+ 0, # int | float (numeric value between 0.0 and 1) in 'Top-p (nucleus sampling)' Slider component
9
+ 1, # int | float (numeric value between 1.0 and 2.0) in 'Repetition penalty' Slider component
10
+ api_name="/chat"
11
+ )
12
+ print(result)