ntaexams commited on
Commit
312778b
Β·
verified Β·
1 Parent(s): 37df77d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -35
app.py CHANGED
@@ -1,38 +1,7 @@
1
  import streamlit as st
2
- from ctransformers import AutoModelForCausalLM
3
 
4
- # βœ… Initialize Streamlit App
5
- st.set_page_config(page_title="Phi-2 AI Chatbot", layout="centered")
6
 
7
- # βœ… Load the model (cached for performance)
8
- @st.cache_resource
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!")