Spaces:
Sleeping
Sleeping
yes
Browse files
app.py
CHANGED
@@ -11,17 +11,17 @@ login(token=token)
|
|
11 |
|
12 |
# Load your model and tokenizer
|
13 |
|
14 |
-
|
15 |
|
16 |
-
prompt="hello
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
|
24 |
-
#
|
25 |
|
26 |
st.title("Your F1 Bro")
|
27 |
|
@@ -32,6 +32,6 @@ if st.button("Submit"):
|
|
32 |
# Tokenize input and make predictions
|
33 |
# inputs = tokenizer(user_input, return_tensors="pt")
|
34 |
# outputs = model(**inputs)
|
35 |
-
|
36 |
|
37 |
-
st.write(
|
|
|
11 |
|
12 |
# Load your model and tokenizer
|
13 |
|
14 |
+
model, tokenizer = load("Rafii/f1llama")
|
15 |
|
16 |
+
prompt="hello"
|
17 |
|
18 |
+
if hasattr(tokenizer, "apply_chat_template") and tokenizer.chat_template is not None:
|
19 |
+
messages = [{"role": "user", "content": prompt}]
|
20 |
+
prompt = tokenizer.apply_chat_template(
|
21 |
+
messages, tokenize=False, add_generation_prompt=True
|
22 |
+
)
|
23 |
|
24 |
+
# response = generate(model, tokenizer, prompt=prompt, verbose=True)
|
25 |
|
26 |
st.title("Your F1 Bro")
|
27 |
|
|
|
32 |
# Tokenize input and make predictions
|
33 |
# inputs = tokenizer(user_input, return_tensors="pt")
|
34 |
# outputs = model(**inputs)
|
35 |
+
response = generate(model, tokenizer, prompt=user_input, verbose=True)
|
36 |
|
37 |
+
st.write(response)
|