Spaces:
Sleeping
Sleeping
Commit
·
b49c9e0
1
Parent(s):
0156b0d
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,6 +2,13 @@ import streamlit as st
|
|
| 2 |
import requests
|
| 3 |
import datetime
|
| 4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
st.header("#CodeWars localGPT", divider='rainbow')
|
| 6 |
|
| 7 |
st.markdown("*#CodeWars* is **really** ***cool***... :sunglasses: our focus is on quality reasoning.")
|
|
@@ -16,7 +23,8 @@ if prompt:
|
|
| 16 |
with st.chat_message(option):
|
| 17 |
st.write(f"{datetime.datetime.now()} :red[{option}:] ", prompt)
|
| 18 |
|
| 19 |
-
response =
|
|
|
|
|
|
|
| 20 |
|
| 21 |
-
|
| 22 |
-
st.write(f"{datetime.datetime.now()}", response)
|
|
|
|
| 2 |
import requests
|
| 3 |
import datetime
|
| 4 |
|
| 5 |
+
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.1"
|
| 6 |
+
headers = {"Authorization": "Bearer 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"}
|
| 7 |
+
|
| 8 |
+
def query(payload):
|
| 9 |
+
response = requests.post(API_URL, headers=headers, json=payload, verify=False)
|
| 10 |
+
return response.json()
|
| 11 |
+
|
| 12 |
st.header("#CodeWars localGPT", divider='rainbow')
|
| 13 |
|
| 14 |
st.markdown("*#CodeWars* is **really** ***cool***... :sunglasses: our focus is on quality reasoning.")
|
|
|
|
| 23 |
with st.chat_message(option):
|
| 24 |
st.write(f"{datetime.datetime.now()} :red[{option}:] ", prompt)
|
| 25 |
|
| 26 |
+
response = query({
|
| 27 |
+
"inputs": prompt,
|
| 28 |
+
})
|
| 29 |
|
| 30 |
+
st.write(f"{datetime.datetime.now()}", response)
|
|
|