Update src/streamlit_app.py
Browse files3 unmodified lines4567891011121314151620 unmodified lines373839403 unmodified linesimport streamlit as st"""# Welcome to Streamlit!Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:.If you have any questions, checkout our [documentation](https://docs.streamlit.io) and [communityforums](https://discuss.streamlit.io).In the meantime, below is an example of what you can do with just a few lines of code:"""num_points = st.slider("Number of points in spiral", 1, 10000, 1100)20 unmodified linesy=alt.Y("y", axis=None),color=alt.Color("idx", legend=None, scale=alt.Scale()),size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),))3 unmodified lines456789101112131420 unmodified lines35363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980813 unmodified linesimport streamlit as st"""# Welcome to MESC Ltd AI!Edit `/streamlit_app.py` to customize this app to your heart's desire :heart:.If you have any questions, checkout our [documentation](https://www.mesc.ltd)"""num_points = st.slider("Number of points in spiral", 1, 10000, 1100)20 unmodified linesy=alt.Y("y", axis=None),color=alt.Color("idx", legend=None, scale=alt.Scale()),size=alt.Size("rand", legend=None, scale=alt.Scale(range=[1, 150])),))import streamlit as stimport requests# --- TOOL CONFIGURATION ---st.set_page_config(page_title="MESC AI Tool", layout="centered")st.title("🌐 MESC Limited")st.subheader("Created by [Muhammad A. Elmleity]")st.write("This tool is multilingual. Simply type in your language.")# This connects to a Free Open Source model (Mistral or Llama)API_URL = "https://api-inference.huggingface.co/models/mistralai/Mistral-7B-Instruct-v0.2"# No API Key is needed for basic public spaces on Hugging Face using their Inference widgetdef query(payload):response = requests.post(API_URL, json=payload)return response.json()# --- USER INTERFACE ---user_input = st.text_area("Welcome To The world Of MESC Ltd Where we are Branding Sustainability", placeholder="How can we help you?...")if st.button("Generate Result"):if user_input:with st.spinner("Analyzing... Using The Brain of Muhammad Elmleity online"):# The prompt ensures it stays multilingual and helpfuloutput = query({"inputs": f"User Language: Auto-detect. Task: Respond helpfully to this: {user_input}","parameters": {"max_new_tokens": 50000}})try:# Displaying the resultresult = output[0]['generated_text']# Cleaning the output to show only the answerclean_result = result.split("Task:")[1] if "Task:" in result else resultst.success(clean_result)except:st.error("The AI is Calling the Publisher up. Please wait 30 seconds and try again!")else:st.warning("Please Call Directly to +201007590100.")st.markdown("---")st.caption("Powered by Https://www.MESC.Ltd | Branding Sustainability")
src/streamlit_app.py+46-5