ariG23498 HF Staff commited on
Commit
0e97d22
·
verified ·
1 Parent(s): 05cfd93

Upload google_gemma-3-27b-it_0.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. google_gemma-3-27b-it_0.py +6 -30
google_gemma-3-27b-it_0.py CHANGED
@@ -11,20 +11,8 @@
11
  # ///
12
 
13
  try:
14
- # Use a pipeline as a high-level helper
15
- from transformers import pipeline
16
-
17
- pipe = pipeline("image-text-to-text", model="google/gemma-3-27b-it")
18
- messages = [
19
- {
20
- "role": "user",
21
- "content": [
22
- {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
23
- {"type": "text", "text": "What animal is on the candy?"}
24
- ]
25
- },
26
- ]
27
- pipe(text=messages)
28
  with open('google_gemma-3-27b-it_0.txt', 'w', encoding='utf-8') as f:
29
  f.write('Everything was good in google_gemma-3-27b-it_0.txt')
30
  except Exception as e:
@@ -38,23 +26,11 @@ except Exception as e:
38
 
39
  with open('google_gemma-3-27b-it_0.txt', 'a', encoding='utf-8') as f:
40
  import traceback
41
- f.write('''
42
- ```CODE:
43
- # Use a pipeline as a high-level helper
44
- from transformers import pipeline
45
-
46
- pipe = pipeline("image-text-to-text", model="google/gemma-3-27b-it")
47
- messages = [
48
- {
49
- "role": "user",
50
- "content": [
51
- {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
52
- {"type": "text", "text": "What animal is on the candy?"}
53
- ]
54
- },
55
- ]
56
- pipe(text=messages)
57
  ```
 
58
  ERROR:
59
  ''')
60
  traceback.print_exc(file=f)
 
11
  # ///
12
 
13
  try:
14
+ from huggingface_hub import login
15
+ login(new_session=False)
 
 
 
 
 
 
 
 
 
 
 
 
16
  with open('google_gemma-3-27b-it_0.txt', 'w', encoding='utf-8') as f:
17
  f.write('Everything was good in google_gemma-3-27b-it_0.txt')
18
  except Exception as e:
 
26
 
27
  with open('google_gemma-3-27b-it_0.txt', 'a', encoding='utf-8') as f:
28
  import traceback
29
+ f.write('''```CODE:
30
+ from huggingface_hub import login
31
+ login(new_session=False)
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ```
33
+
34
  ERROR:
35
  ''')
36
  traceback.print_exc(file=f)