Spaces:
Sleeping
Sleeping
Rijgersberg
commited on
Commit
•
e88dcad
1
Parent(s):
d00e77f
Update app.py
Browse files
app.py
CHANGED
@@ -11,15 +11,15 @@ from transformers import AutoModelForCausalLM, AutoTokenizer, TextIteratorStream
|
|
11 |
|
12 |
MAX_MAX_NEW_TOKENS = 2048
|
13 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
14 |
-
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "
|
15 |
|
16 |
if torch.cuda.is_available():
|
17 |
-
model_id = "
|
18 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="cuda")
|
19 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
20 |
|
21 |
|
22 |
-
@spaces.GPU(duration=
|
23 |
def generate(
|
24 |
message: str,
|
25 |
chat_history: list[tuple[str, str]],
|
@@ -64,7 +64,7 @@ def generate(
|
|
64 |
chat_interface = gr.ChatInterface(
|
65 |
fn=generate,
|
66 |
chatbot=gr.Chatbot(height=450,
|
67 |
-
label="
|
68 |
show_share_button=True,
|
69 |
# avatar_images=(None, 'geitje-logo.jpg')
|
70 |
),
|
@@ -108,40 +108,60 @@ chat_interface = gr.ChatInterface(
|
|
108 |
),
|
109 |
],
|
110 |
examples=[
|
111 |
-
["""
|
112 |
-
["
|
113 |
-
["Wat
|
114 |
-
["
|
115 |
-
["
|
116 |
-
["
|
117 |
["""```
|
118 |
-
|
119 |
-
Door onze economieredactie
|
120 |
-
14 dec 2023 om 12:58
|
121 |
-
Update: 20 uur geleden
|
122 |
-
162 reacties
|
123 |
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
|
128 |
-
|
|
|
|
|
|
|
|
|
129 |
|
130 |
-
|
|
|
131 |
|
132 |
-
|
|
|
133 |
|
134 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
135 |
```
|
136 |
-
|
137 |
],
|
138 |
-
title="
|
139 |
-
description="""
|
140 |
-
submit_btn="
|
141 |
stop_btn="Stop",
|
142 |
-
retry_btn="🔄
|
143 |
-
undo_btn="↩️
|
144 |
-
clear_btn="🗑️
|
145 |
)
|
146 |
|
147 |
with gr.Blocks(css="style.css") as demo:
|
|
|
11 |
|
12 |
MAX_MAX_NEW_TOKENS = 2048
|
13 |
DEFAULT_MAX_NEW_TOKENS = 1024
|
14 |
+
MAX_INPUT_TOKEN_LENGTH = int(os.getenv("MAX_INPUT_TOKEN_LENGTH", "2048"))
|
15 |
|
16 |
if torch.cuda.is_available():
|
17 |
+
model_id = "pints-ai/1.5-Pints-2K-v0.1"
|
18 |
model = AutoModelForCausalLM.from_pretrained(model_id, torch_dtype=torch.bfloat16, device_map="cuda")
|
19 |
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
20 |
|
21 |
|
22 |
+
@spaces.GPU(duration=60)
|
23 |
def generate(
|
24 |
message: str,
|
25 |
chat_history: list[tuple[str, str]],
|
|
|
64 |
chat_interface = gr.ChatInterface(
|
65 |
fn=generate,
|
66 |
chatbot=gr.Chatbot(height=450,
|
67 |
+
label="pints-ai/1.5-Pints-2K-v0.1",
|
68 |
show_share_button=True,
|
69 |
# avatar_images=(None, 'geitje-logo.jpg')
|
70 |
),
|
|
|
108 |
),
|
109 |
],
|
110 |
examples=[
|
111 |
+
["""What word does not belong in this sequence: "car, airplane, goat, bus"?"""],
|
112 |
+
["Write a news article for The Onion about the application of a herd of goats by the Netherlands Forensic Institute"],
|
113 |
+
["Wat are 3 nice things to do when I visit Amsterdam for a weekend?"],
|
114 |
+
["Who is the partner of Batman?"],
|
115 |
+
["Can you cycle to the moon?"],
|
116 |
+
["What is the importance of open source language models?"],
|
117 |
["""```
|
118 |
+
Auckland Zoo otter Jin has been found alive
|
|
|
|
|
|
|
|
|
119 |
|
120 |
+
Monday, July 10, 2006
|
121 |
+
New Zealand
|
122 |
+
Related articles
|
123 |
|
124 |
+
9 May 2023: First NASA TROPICS satellites launch to monitor tropical storms
|
125 |
+
31 January 2023: "Energized and excited": Chris Hipkins becomes 41st Prime Minister of New Zealand
|
126 |
+
12 February 2022: US warns its citizens to leave Ukraine as Russia could invade 'anytime'
|
127 |
+
25 November 2021: New Zealand raises interest rates in second straight month to 0.75%
|
128 |
+
5 September 2021: At least six injured after stabbing in New Zealand supermarket
|
129 |
|
130 |
+
Location of New Zealand
|
131 |
+
Collaborate!
|
132 |
|
133 |
+
Pillars of Wikinews writing
|
134 |
+
Writing an article
|
135 |
|
136 |
+
New Zealand
|
137 |
+
|
138 |
+
Jin, the short-clawed Asiatic otter who escaped from the Auckland Zoo almost a month ago, has been found alive.
|
139 |
+
|
140 |
+
Jin escaped from the zoo by digging through two walls and scaling a 1.8 metre high barrier around her enclosure.
|
141 |
+
|
142 |
+
She successfully evaded capture despite numerous sightings around Auckland's inner harbours.
|
143 |
+
|
144 |
+
The New Zealand Department of Conservation says a tip-off from a yachtie helped bring an escaped zoo otter's days of freedom to an end this morning, the yachtie spotted her at Islington Bay, at the causeway between Rangitoto and Motutapu island.
|
145 |
+
|
146 |
+
Auckland Zoo senior vet Dr Richard Jakob-Hoff said Jin has “…got to take her time and relax in her own time. She is in quite good condition and is well hydrated... She's lost a lot of weight but given that she is really in very good condition."
|
147 |
+
|
148 |
+
She has abrasions on her head, another under her tail and on her back paws.
|
149 |
+
|
150 |
+
When Jin first left the enclosure she weighed 3.6-kilograms (kg) and when she was caught she weighed 2.5 kg.
|
151 |
+
|
152 |
+
She is currently in quarantine for 30 days to make sure she is free of any infections that she could have caught from the outside world. The infection she would most likely get would be salmonella from the raw food she has been eating.
|
153 |
+
|
154 |
+
"The most common thing in these types of animals is that toxoplasmosis can cause blindness and can get into the brain and cause fits... She has been very stressed and that is what I am concerned about." said Dr Richard Jakob-Hoff.
|
155 |
```
|
156 |
+
Summarize the above article"""]
|
157 |
],
|
158 |
+
title="pints-ai/1.5-Pints-2K-v0.1",
|
159 |
+
description="""pints-ai/1.5-Pints-2K-v0.1 quick demo""",
|
160 |
+
submit_btn="Generate",
|
161 |
stop_btn="Stop",
|
162 |
+
retry_btn="🔄 Retry",
|
163 |
+
undo_btn="↩️ Undo",
|
164 |
+
clear_btn="🗑️ Clear",
|
165 |
)
|
166 |
|
167 |
with gr.Blocks(css="style.css") as demo:
|