Spaces:
Sleeping
Sleeping
File size: 1,648 Bytes
4adef30 460b935 7536c5d d1a29d0 4adef30 460b935 4adef30 460b935 3e19cc5 460b935 d1a29d0 460b935 d1a29d0 460b935 d1a29d0 460b935 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
import streamlit as st
# Your existing demos
from assist.chat import chat as embed_chat
from assist.bayes_chat import bayes_chat
from assist.transformer_demo import transformer_next
# DeepSeek imports
from transformers import AutoModelForCausalLM, AutoTokenizer, TextGenerationPipeline
st.set_page_config(page_title="RepoSage All-in-One Demo", layout="wide")
st.title("🤖 RepoSage Unified Demo")
# Cache and load DeepSeek-R1
@st.cache_resource
def load_deepseek():
model_name = "deepseek-ai/DeepSeek-Coder-1.3B-base"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(model_name)
return TextGenerationPipeline(model=model, tokenizer=tokenizer)
deepseek_gen = load_deepseek()
# User input
question = st.text_input("Enter your question or prompt below:")
# Four buttons side by side, with DeepSeek first
col1, col2, col3, col4 = st.columns(4)
with col1:
if st.button("DeepSeek-R1 Demo"):
if not question.strip():
st.warning("Please enter a prompt first.")
else:
with st.spinner("Generating with DeepSeek…"):
out = deepseek_gen(question, max_new_tokens=100, do_sample=True)
st.code(out[0]["generated_text"], language="text")
with col2:
if st.button("Embedding Q&A"):
st.write(embed_chat(question))
with col3:
if st.button("Bayesian Q&A"):
st.write(bayes_chat(question))
with col4:
if st.button("Transformer Demo"):
st.write(transformer_next(question))
st.markdown("---")
st.caption("DeepSeek-R1, Embedding, Bayesian & Transformer demos all in one place ✅")
|