arhamTariq commited on
Commit
9259385
·
verified ·
1 Parent(s): 17d9efa

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -7
app.py CHANGED
@@ -4,17 +4,15 @@ from huggingface_hub import InferenceClient
4
  api_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
5
 
6
  client = InferenceClient(
7
- model="google/flan-t5-large",
8
  token=api_token
9
  )
10
 
11
  prompt = "Hello world"
12
 
13
- # You can also specify additional parameters
14
- response = client.text_generation(
15
- prompt=prompt,
16
- max_new_tokens=50,
17
- temperature=0.7
18
  )
19
 
20
- print(response)
 
4
  api_token = os.environ.get("HUGGINGFACEHUB_API_TOKEN")
5
 
6
  client = InferenceClient(
7
+ model="mistralai/Mistral-7B-Instruct-v0.2", # Example chat model
8
  token=api_token
9
  )
10
 
11
  prompt = "Hello world"
12
 
13
+ # For chat models
14
+ response = client.chat_completion(
15
+ messages=[{"role": "user", "content": prompt}]
 
 
16
  )
17
 
18
+ print(response.choices[0].message.content)