Spaces:
Runtime error
Runtime error
import gradio as gr | |
import requests | |
API_URL = "https://api-inference.huggingface.co/models/mlabonne/Meta-Llama-3.1-8B-Instruct-abliterated" | |
headers = {"Authorization": "Bearer hf_..."} # Replace with your Hugging Face API token | |
def query(payload): | |
response = requests.post(API_URL, headers=headers, json=payload) | |
return response.json() | |
def generate_text(prompt): | |
output = query({ | |
"inputs": prompt, | |
"parameters": {"max_new_tokens": 200} | |
}) | |
return output[0]['generated_text'] | |
iface = gr.Interface(fn=generate_text, inputs="text", outputs="text") | |
iface.launch() |