Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,38 +1,7 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
-
from ctransformers import AutoModelForCausalLM
|
| 3 |
|
| 4 |
-
|
| 5 |
-
st.
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
def load_model():
|
| 10 |
-
model_repo = "TheBloke/Phi-2-GGUF"
|
| 11 |
-
model_file = "phi-2.Q4_K_S.gguf"
|
| 12 |
-
|
| 13 |
-
return AutoModelForCausalLM.from_pretrained(
|
| 14 |
-
model_repo,
|
| 15 |
-
model_file=model_file,
|
| 16 |
-
model_type="phi2"
|
| 17 |
-
)
|
| 18 |
-
|
| 19 |
-
st.title("π€ Phi-2 AI Chatbot")
|
| 20 |
-
st.markdown("π Running Phi-2 GGUF on Hugging Face Spaces")
|
| 21 |
-
|
| 22 |
-
# Load Model
|
| 23 |
-
try:
|
| 24 |
-
model = load_model()
|
| 25 |
-
st.success("β
Phi-2 Model Loaded Successfully!")
|
| 26 |
-
except Exception as e:
|
| 27 |
-
st.error(f"β Error Loading Model: {e}")
|
| 28 |
-
|
| 29 |
-
# User Input
|
| 30 |
-
user_input = st.text_area("π¬ Ask your question:", "")
|
| 31 |
-
|
| 32 |
-
if st.button("Generate Response"):
|
| 33 |
-
if user_input:
|
| 34 |
-
response = model(user_input)
|
| 35 |
-
st.write("π€ **AI Response:**")
|
| 36 |
-
st.write(response)
|
| 37 |
-
else:
|
| 38 |
-
st.warning("β οΈ Please enter a question!")
|
|
|
|
| 1 |
import streamlit as st
|
|
|
|
| 2 |
|
| 3 |
+
st.title("π Testing Streamlit on Hugging Face")
|
| 4 |
+
st.write("β
If you see this message, Streamlit is working fine!")
|
| 5 |
|
| 6 |
+
if st.button("Click Me"):
|
| 7 |
+
st.success("π Streamlit is working!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|