Spaces:
Build error
Build error
Upload 4 files
Browse files- .gitignore +2 -0
- README.md +10 -6
- app.py +26 -0
- requirements.txt +2 -0
.gitignore
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
__pycache__/
|
| 2 |
+
*.pyc
|
README.md
CHANGED
|
@@ -1,11 +1,15 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
-
colorTo:
|
| 6 |
-
sdk:
|
|
|
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
---
|
| 10 |
|
| 11 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: Cybertron Chat
|
| 3 |
+
emoji: ⚡
|
| 4 |
+
colorFrom: gray
|
| 5 |
+
colorTo: green
|
| 6 |
+
sdk: streamlit
|
| 7 |
+
sdk_version: 1.32.2
|
| 8 |
+
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
license: apache-2.0
|
| 11 |
---
|
| 12 |
|
| 13 |
+
# Cybertron Chat Space
|
| 14 |
+
|
| 15 |
+
Streamlit app to interact with the Cybertron GGUF model using llama-cpp-python.
|
app.py
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from llama_cpp import Llama
|
| 3 |
+
|
| 4 |
+
@st.cache_resource
|
| 5 |
+
def load_model():
|
| 6 |
+
return Llama(
|
| 7 |
+
model_path="cybertron-v4-qw7B-MGS-IQ2_M.gguf",
|
| 8 |
+
n_ctx=2048,
|
| 9 |
+
n_threads=8,
|
| 10 |
+
n_gpu_layers=20
|
| 11 |
+
)
|
| 12 |
+
|
| 13 |
+
llm = load_model()
|
| 14 |
+
|
| 15 |
+
st.title("Cybertron Chat")
|
| 16 |
+
|
| 17 |
+
prompt = st.text_input("Ask a question:")
|
| 18 |
+
|
| 19 |
+
if prompt:
|
| 20 |
+
with st.spinner("Generating response..."):
|
| 21 |
+
response = llm.create_chat_completion(
|
| 22 |
+
messages=[{"role": "user", "content": prompt}],
|
| 23 |
+
temperature=0.7,
|
| 24 |
+
max_tokens=256
|
| 25 |
+
)
|
| 26 |
+
st.write(response["choices"][0]["message"]["content"])
|
requirements.txt
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
|
|
|
| 1 |
+
llama-cpp-python
|
| 2 |
+
streamlit
|