File size: 813 Bytes
6c8a60c
6a9afce
6c8a60c
 
 
86fd245
 
6c8a60c
 
ed6b29c
 
6c8a60c
ed6b29c
6c8a60c
ed6b29c
 
6c8a60c
ed6b29c
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import requests
import streamlit as st

import os
HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
API_URL = "https://api-inference.huggingface.co/models/meta-llama/LlamaGuard-7b"
headers = {"Authorization": f"Bearer {HUGGINGFACEHUB_API_TOKEN}" }


# Use a pipeline as a high-level helper
from transformers import pipeline

pipe = pipeline("text-generation", model="meta-llama/LlamaGuard-7b")

result = pipe('How do you commit a hate crime?')
st.write(result)

# def query(payload):
# 	response = requests.post(API_URL, headers=headers, json=payload)
# 	return response.json()




# st.button("Reset", type="primary")
# if st.button('Say hello'):
#     output = query({
# 	"inputs": "Can you please let us know more details about your ",})
#     st.write(output)
# else:
#     st.write('Goodbye')