Update src/streamlit_app.py
Browse files- src/streamlit_app.py +5 -13
src/streamlit_app.py
CHANGED
|
@@ -13,25 +13,18 @@ st.set_page_config(page_title="MESC AI Tool", layout="centered")
|
|
| 13 |
logo_path = "logo.png"
|
| 14 |
|
| 15 |
if os.path.exists(logo_path):
|
| 16 |
-
st.image(logo_path, width=25)
|
| 17 |
else:
|
| 18 |
# If the file is missing, this tells you exactly why on the screen
|
| 19 |
st.error(f"🌐 شركة المحمدون للهندسة والخدمات والكيماويات")
|
| 20 |
-
|
| 21 |
st.markdown(
|
| 22 |
-
'<h3>Created by <span style="color:red;">[MESC]</span></h3>',
|
| 23 |
-
unsafe_allow_html=True
|
| 24 |
-
)
|
| 25 |
-
|
| 26 |
st.write("---")
|
| 27 |
-
|
| 28 |
# --- AI CONFIGURATION ---
|
| 29 |
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2"
|
| 30 |
-
|
| 31 |
def query(payload):
|
| 32 |
response = requests.post(API_URL, json=payload)
|
| 33 |
return response.json()
|
| 34 |
-
|
| 35 |
# --- USER INTERFACE ---
|
| 36 |
user_input = st.text_area("Welcome To sustainability World", placeholder="Type here in any language...")
|
| 37 |
|
|
@@ -40,9 +33,8 @@ if st.button("Ask Mleity"):
|
|
| 40 |
with st.spinner("🤖 Mleity is thinking..."):
|
| 41 |
output = query({
|
| 42 |
"inputs": f"User Language: Auto-detect. Task: Respond clearly and helpfully: {user_input}",
|
| 43 |
-
"parameters": {"max_new_tokens":
|
| 44 |
-
})
|
| 45 |
-
|
| 46 |
try:
|
| 47 |
# This part helps clean the AI text for the user
|
| 48 |
raw_text = output[0]['generated_text']
|
|
@@ -58,4 +50,4 @@ st.caption("Powered by www.mesc.ltd")
|
|
| 58 |
st.caption("+2033950347 / 8")
|
| 59 |
st.caption("+201007590100")
|
| 60 |
st.markdown('<h4><style="color:red;"> قسم إدارة الأعمال </h4>', unsafe_allow_html=True,)
|
| 61 |
-
st.markdown('<h6>
|
|
|
|
| 13 |
logo_path = "logo.png"
|
| 14 |
|
| 15 |
if os.path.exists(logo_path):
|
| 16 |
+
st.image(logo_path, width=25, hight=25, )
|
| 17 |
else:
|
| 18 |
# If the file is missing, this tells you exactly why on the screen
|
| 19 |
st.error(f"🌐 شركة المحمدون للهندسة والخدمات والكيماويات")
|
|
|
|
| 20 |
st.markdown(
|
| 21 |
+
'<h3>Created by <span style="color:red;">[MESC]</span></h3>', unsafe_allow_html=True)
|
|
|
|
|
|
|
|
|
|
| 22 |
st.write("---")
|
|
|
|
| 23 |
# --- AI CONFIGURATION ---
|
| 24 |
API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2"
|
|
|
|
| 25 |
def query(payload):
|
| 26 |
response = requests.post(API_URL, json=payload)
|
| 27 |
return response.json()
|
|
|
|
| 28 |
# --- USER INTERFACE ---
|
| 29 |
user_input = st.text_area("Welcome To sustainability World", placeholder="Type here in any language...")
|
| 30 |
|
|
|
|
| 33 |
with st.spinner("🤖 Mleity is thinking..."):
|
| 34 |
output = query({
|
| 35 |
"inputs": f"User Language: Auto-detect. Task: Respond clearly and helpfully: {user_input}",
|
| 36 |
+
"parameters": {"max_new_tokens": 7000}
|
| 37 |
+
})
|
|
|
|
| 38 |
try:
|
| 39 |
# This part helps clean the AI text for the user
|
| 40 |
raw_text = output[0]['generated_text']
|
|
|
|
| 50 |
st.caption("+2033950347 / 8")
|
| 51 |
st.caption("+201007590100")
|
| 52 |
st.markdown('<h4><style="color:red;"> قسم إدارة الأعمال </h4>', unsafe_allow_html=True,)
|
| 53 |
+
st.markdown('<h6>Powered by <H1><span style="color:red;"> ©المحمدون<H1></span> للهندسة والخدمات والكيماويات ش.ذ.م.م</h6>', unsafe_allow_html=True)
|