Chris4K commited on
Commit
58b75c9
1 Parent(s): c4cb5ac

Update text_generator.py

Browse files
Files changed (1) hide show
  1. text_generator.py +9 -7
text_generator.py CHANGED
@@ -16,15 +16,17 @@ class TextGenerationTool(Tool):
16
  def __call__(self, prompt: str):
17
  API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-v0.1"
18
  headers = {"Authorization": os.environ['hf']}
 
 
 
 
19
 
20
- def query(payload):
21
- response = requests.post(API_URL, headers=headers, json=payload)
22
- print(response)
23
- return response.json()
24
 
25
- output = query({
26
- "inputs": prompt,
27
- })
28
 
29
  # Define the payload for the request
30
  #payload = {
 
16
  def __call__(self, prompt: str):
17
  API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-v0.1"
18
  headers = {"Authorization": os.environ['hf']}
19
+
20
+ payload = {
21
+ "inputs": prompt # Adjust this based on your model's input format
22
+ }
23
 
24
+ #def query(payload):
25
+ response = requests.post(API_URL, headers=headers, json=payload)
26
+ print(response)
27
+ return response.json()
28
 
29
+
 
 
30
 
31
  # Define the payload for the request
32
  #payload = {