KingZack commited on
Commit
86fd245
1 Parent(s): 6a9afce

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -14
app.py CHANGED
@@ -3,22 +3,20 @@ import streamlit as st
3
 
4
  import os
5
  HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
 
 
6
 
7
- st.button("Reset", type="primary")
8
- if st.button('Say hello'):
9
- st.write('Why hello there')
10
- else:
11
- st.write('Goodbye')
12
 
13
-
14
 
15
- # API_URL = "https://api-inference.huggingface.co/models/meta-llama/LlamaGuard-7b"
16
- # headers = {"Authorization": "Bearer {HUGGINGFACEHUB_API_TOKEN}"}
17
 
18
- # def query(payload):
19
- # response = requests.post(API_URL, headers=headers, json=payload)
20
- # return response.json()
21
 
22
- # output = query({
23
- # "inputs": "Can you please let us know more details about your ",
24
- # })
 
 
 
 
 
3
 
4
  import os
5
  HUGGINGFACEHUB_API_TOKEN = os.getenv("HUGGINGFACEHUB_API_TOKEN")
6
+ API_URL = "https://api-inference.huggingface.co/models/meta-llama/LlamaGuard-7b"
7
+ headers = {"Authorization": f"Bearer {HUGGINGFACEHUB_API_TOKEN}" }
8
 
9
+ def query(payload):
10
+ response = requests.post(API_URL, headers=headers, json=payload)
11
+ return response.json()
 
 
12
 
 
13
 
 
 
14
 
 
 
 
15
 
16
+ st.button("Reset", type="primary")
17
+ if st.button('Say hello'):
18
+ output = query({
19
+ "inputs": "Can you please let us know more details about your ",})
20
+ st.write(output)
21
+ else:
22
+ st.write('Goodbye')