ashutoshzade commited on
Commit
785eaab
·
verified ·
1 Parent(s): 1658ca5

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -0
app.py ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from transformers import pipeline
3
+
4
+ pipe = pipeline(
5
+ "text-generation",
6
+ model="google/gemma-2-2b",
7
+ device="cuda", # replace with "mps" to run on a Mac device
8
+ )
9
+
10
+ text = "Once upon a time,"
11
+ outputs = pipe(text, max_new_tokens=256)
12
+ response = outputs[0]["generated_text"]
13
+ print(response)