Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,7 @@ import plotly.figure_factory as ff
|
|
9 |
import requests
|
10 |
import time
|
11 |
from tqdm import tqdm
|
12 |
-
from transformers import pipeline
|
13 |
-
|
14 |
|
15 |
def sorting(df):
|
16 |
df.index = list(map(float, df.index))
|
@@ -1017,10 +1016,15 @@ try:
|
|
1017 |
|
1018 |
elif main_option == "AI Chat":
|
1019 |
prompt_user = st.text_input("Write a prompt.")
|
|
|
|
|
|
|
|
|
|
|
|
|
1020 |
messages = [
|
1021 |
{"role": "user", "content": prompt_user},
|
1022 |
]
|
1023 |
-
pipe = pipeline("text-generation", model="deepseek-ai/DeepSeek-R1", trust_remote_code=True, device_map="auto") # Added device_map
|
1024 |
st.markdown(pipe(messages))
|
1025 |
|
1026 |
except Exception as e:
|
|
|
9 |
import requests
|
10 |
import time
|
11 |
from tqdm import tqdm
|
12 |
+
from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
|
|
|
13 |
|
14 |
def sorting(df):
|
15 |
df.index = list(map(float, df.index))
|
|
|
1016 |
|
1017 |
elif main_option == "AI Chat":
|
1018 |
prompt_user = st.text_input("Write a prompt.")
|
1019 |
+
|
1020 |
+
model_name = "deepseek-ai/DeepSeek-R1"
|
1021 |
+
model = AutoModelForCausalLM.from_pretrained(model_name, trust_remote_code=True)
|
1022 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
|
1023 |
+
|
1024 |
+
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
|
1025 |
messages = [
|
1026 |
{"role": "user", "content": prompt_user},
|
1027 |
]
|
|
|
1028 |
st.markdown(pipe(messages))
|
1029 |
|
1030 |
except Exception as e:
|