Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import requests | |
| import datetime | |
| API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.1" | |
| headers = {"Authorization": "Bearer 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"} | |
| def query(payload): | |
| response = requests.post(API_URL, headers=headers, json=payload, verify=False) | |
| return response.json() | |
| st.header("#CodeWars localGPT", divider='rainbow') | |
| st.markdown("*#CodeWars* is **really** ***cool***... :sunglasses: our focus is on quality reasoning.") | |
| option = st.selectbox('What is your role?', ('Support', 'Sales')) | |
| st.write('You selected', option) | |
| prompt = st.chat_input("Say something to our #CodeWars bot...") | |
| if prompt: | |
| with st.chat_message(option): | |
| st.write(f"{datetime.datetime.now()} :red[{option}:] ", prompt) | |
| response = query({ | |
| "inputs": prompt, | |
| }) | |
| st.write(f"{datetime.datetime.now()}", response) |