Rijgersberg commited on
Commit
e88dcad
1 Parent(s): d00e77f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +49 -29
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", "8192"))
15
 
16
  if torch.cuda.is_available():
17
- model_id = "google/gemma-2-9b-it"
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=160)
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="google/gemma-2-9b-it",
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
- ["""Vraagje: welk woord hoort er niet in dit rijtje thuis: "auto, vliegtuig, geit, bus"?"""],
112
- ["Schrijf een nieuwsbericht voor De Speld over de inzet van een kudde geiten door het Nederlands Forensisch Instituut"],
113
- ["Wat zijn 3 leuke dingen om te doen als ik een weekendje naar Friesland ga?"],
114
- ["Met wie trad clown Bassie op?"],
115
- ["Kan je naar de maan fietsen?"],
116
- ["Wat is het belang van open source taalmodellen?"],
117
  ["""```
118
- Wortelverkopers krijgen miljoenenboete voor ongeoorloofd samenspannen
119
- Door onze economieredactie
120
- 14 dec 2023 om 12:58
121
- Update: 20 uur geleden
122
- 162 reacties
123
 
124
- Delen
125
- Toezichthouder ACM heeft een Nederlands wortelkartel aangepakt. Vier telers en verkopers van wortelen krijgen samen ruim 2,5 miljoen euro boete vanwege ongeoorloofde afspraken over het verdelen van de markt.
126
- Het gaat om telers en verkopers Laarakker, VanRijsingen, Veco en Verduyn. De vier bedrijven verkopen waspeen en Parijse wortelen aan conserven- en diepvriesfabrikanten in Nederland, België en Duitsland. Waspeen wordt vaak verkocht in potten of blikken in een mix met erwtjes.
127
 
128
- De vier bedrijven hadden in 2018 afgesproken dat ze tien jaar lang niet overal de concurrentie met elkaar zouden aangaan. Zo zou Veco tien jaar lang geen waspeen telen of verkopen. Daarnaast zouden Laarakker, VanRijsingen en Verduyn juist de Parijse wortelen links laten liggen.
 
 
 
 
129
 
130
- Ook betaalden de andere wortelverkopers Veco ter compensatie van de afspraken. Laarakker en Veco maakten ook nog afzonderlijke afspraken over de levering van Parijse wortelen aan Duitse klanten.
 
131
 
132
- Zulke afspraken zijn verboden. Als concurrentie door die samenwerking achterwege blijft en er dus sprake is van een kartel, betalen kopers mogelijk een hogere prijs, stelt de ACM.
 
133
 
134
- Twee van de wortelbedrijven werkten mee door meer informatie over de ongeoorloofde afspraken te delen met de toezichthouder. Daardoor kregen zij een lagere boete.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  ```
136
- Vat bovenstaand artikel samen"""]
137
  ],
138
- title="google/gemma-2-9b-it",
139
- description="""google/gemma-2-9b-it quick demo""",
140
- submit_btn="Genereer",
141
  stop_btn="Stop",
142
- retry_btn="🔄 Opnieuw",
143
- undo_btn="↩️ Ongedaan maken",
144
- clear_btn="🗑️ Wissen",
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: