Spaces:
Sleeping
Sleeping
| import os | |
| import requests | |
| import gradio as gr | |
| API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2" | |
| headers = {"Authorization": f"Bearer {os.getenv('HF_TOKEN')}"} | |
| def respond(message, history): | |
| payload = {"inputs": message} | |
| response = requests.post(API_URL, headers=headers, json=payload) | |
| return response.json()[0]["generated_text"] | |
| demo = gr.ChatInterface(respond) | |
| demo.launch() |