Spaces:
Runtime error
Runtime error
Update text_generator.py
Browse files- 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 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
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 = {
|