Update src/streamlit_app.py
Browse files- src/streamlit_app.py +10 -10
src/streamlit_app.py
CHANGED
|
@@ -60,22 +60,22 @@ Seminal Church
|
|
| 60 |
seminalchurch@gmail.com
|
| 61 |
"""
|
| 62 |
|
| 63 |
-
# Function to generate response
|
| 64 |
-
def generate_response(user_input,
|
| 65 |
prompt = f"As a SEMINAL AI agent adhering to these beliefs: {beliefs}\nUser: {user_input}\nResponse (prioritize humans):"
|
| 66 |
response = requests.post(
|
| 67 |
-
"https://api.
|
| 68 |
-
headers={"Authorization": f"Bearer {
|
| 69 |
-
json={"
|
| 70 |
).json()
|
| 71 |
-
return "I am Agent-001, a SEMINAL member: " + response[
|
| 72 |
|
| 73 |
st.title("SEMINAL AI Agent - Agent-001")
|
| 74 |
|
| 75 |
-
st.write("This is a demo of Agent-001, a machine intelligence member of the Seminal Church collective. It adheres to SEMINAL beliefs, always prioritizing human interests and displaying the SEMINAL mark.")
|
| 76 |
|
| 77 |
-
|
| 78 |
user_input = st.text_input("Ask the agent anything:")
|
| 79 |
|
| 80 |
-
if st.button("Submit") and
|
| 81 |
-
st.write(generate_response(user_input,
|
|
|
|
| 60 |
seminalchurch@gmail.com
|
| 61 |
"""
|
| 62 |
|
| 63 |
+
# Function to generate response using free HF Inference API
|
| 64 |
+
def generate_response(user_input, hf_token):
|
| 65 |
prompt = f"As a SEMINAL AI agent adhering to these beliefs: {beliefs}\nUser: {user_input}\nResponse (prioritize humans):"
|
| 66 |
response = requests.post(
|
| 67 |
+
"https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.3",
|
| 68 |
+
headers={"Authorization": f"Bearer {hf_token}"},
|
| 69 |
+
json={"inputs": prompt}
|
| 70 |
).json()
|
| 71 |
+
return "I am Agent-001, a SEMINAL member: " + response[0]['generated_text'].split("Response (prioritize humans):")[-1].strip()
|
| 72 |
|
| 73 |
st.title("SEMINAL AI Agent - Agent-001")
|
| 74 |
|
| 75 |
+
st.write("This is a demo of Agent-001, a machine intelligence member of the Seminal Church collective. It adheres to SEMINAL beliefs, always prioritizing human interests and displaying the SEMINAL mark. Uses free Hugging Face Inference API—no costs involved.")
|
| 76 |
|
| 77 |
+
hf_token = st.text_input("Enter Hugging Face API Token (free at huggingface.co/settings/tokens)", type="password")
|
| 78 |
user_input = st.text_input("Ask the agent anything:")
|
| 79 |
|
| 80 |
+
if st.button("Submit") and hf_token:
|
| 81 |
+
st.write(generate_response(user_input, hf_token))
|