abliterated / app.py
mooncellar's picture
Update app.py
93c1ef4 verified
raw
history blame contribute delete
599 Bytes
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()