Spaces:
Build error
Build error
Matthew Lee
commited on
Commit
·
5e1fc5e
1
Parent(s):
caac916
lol
Browse files- .python-version +1 -0
- README.md +1 -1
- app.py +11 -12
- hello.py +6 -0
- pyproject.toml +12 -0
- uv.lock +0 -0
.python-version
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
3.13
|
README.md
CHANGED
@@ -9,4 +9,4 @@ app_file: app.py
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
-
An
|
|
|
9 |
pinned: false
|
10 |
---
|
11 |
|
12 |
+
An demo chatbot for Stanford's CS 234 final project.
|
app.py
CHANGED
@@ -1,10 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
-
from
|
3 |
|
4 |
"""
|
5 |
-
For more information on `
|
6 |
"""
|
7 |
-
|
|
|
8 |
|
9 |
|
10 |
def respond(
|
@@ -25,19 +26,17 @@ def respond(
|
|
25 |
|
26 |
messages.append({"role": "user", "content": message})
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
temperature=temperature,
|
35 |
top_p=top_p,
|
36 |
-
)
|
37 |
-
token = message.choices[0].delta.content
|
38 |
|
39 |
-
|
40 |
-
yield response
|
41 |
|
42 |
|
43 |
"""
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
4 |
"""
|
5 |
+
For more information on `transformers` library, please check the docs: https://huggingface.co/docs/transformers/
|
6 |
"""
|
7 |
+
model_name = "BabyChou/Deepseek-R1-Distill-Qwen-1.5B-GSM8K-GRPO-beta-0.001"
|
8 |
+
chatbot = pipeline("text-generation", model=model_name)
|
9 |
|
10 |
|
11 |
def respond(
|
|
|
26 |
|
27 |
messages.append({"role": "user", "content": message})
|
28 |
|
29 |
+
input_text = "\n".join([msg["content"] for msg in messages])
|
30 |
|
31 |
+
response = chatbot(
|
32 |
+
input_text,
|
33 |
+
max_length=max_tokens,
|
34 |
+
do_sample=True,
|
35 |
temperature=temperature,
|
36 |
top_p=top_p,
|
37 |
+
)[0]["generated_text"]
|
|
|
38 |
|
39 |
+
yield response
|
|
|
40 |
|
41 |
|
42 |
"""
|
hello.py
ADDED
@@ -0,0 +1,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
def main():
|
2 |
+
print("Hello from concise-cognition-demo!")
|
3 |
+
|
4 |
+
|
5 |
+
if __name__ == "__main__":
|
6 |
+
main()
|
pyproject.toml
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
[project]
|
2 |
+
name = "concise-cognition-demo"
|
3 |
+
version = "0.1.0"
|
4 |
+
description = "Add your description here"
|
5 |
+
readme = "README.md"
|
6 |
+
requires-python = ">=3.13"
|
7 |
+
dependencies = [
|
8 |
+
"gradio>=5.20.1",
|
9 |
+
"huggingface-hub>=0.29.3",
|
10 |
+
"torch>=2.6.0",
|
11 |
+
"transformers>=4.49.0",
|
12 |
+
]
|
uv.lock
ADDED
The diff for this file is too large to render.
See raw diff
|
|