Upload stepfun-ai_GELab-Zero-4B-preview_0.py with huggingface_hub
Browse files
stepfun-ai_GELab-Zero-4B-preview_0.py
CHANGED
|
@@ -23,7 +23,17 @@ try:
|
|
| 23 |
# Use a pipeline as a high-level helper
|
| 24 |
from transformers import pipeline
|
| 25 |
|
| 26 |
-
pipe = pipeline("image-to-text", model="stepfun-ai/GELab-Zero-4B-preview")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
with open('stepfun-ai_GELab-Zero-4B-preview_0.txt', 'w', encoding='utf-8') as f:
|
| 28 |
f.write('Everything was good in stepfun-ai_GELab-Zero-4B-preview_0.txt')
|
| 29 |
except Exception as e:
|
|
@@ -41,7 +51,17 @@ except Exception as e:
|
|
| 41 |
# Use a pipeline as a high-level helper
|
| 42 |
from transformers import pipeline
|
| 43 |
|
| 44 |
-
pipe = pipeline("image-to-text", model="stepfun-ai/GELab-Zero-4B-preview")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
```
|
| 46 |
|
| 47 |
ERROR:
|
|
|
|
| 23 |
# Use a pipeline as a high-level helper
|
| 24 |
from transformers import pipeline
|
| 25 |
|
| 26 |
+
pipe = pipeline("image-text-to-text", model="stepfun-ai/GELab-Zero-4B-preview")
|
| 27 |
+
messages = [
|
| 28 |
+
{
|
| 29 |
+
"role": "user",
|
| 30 |
+
"content": [
|
| 31 |
+
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
|
| 32 |
+
{"type": "text", "text": "What animal is on the candy?"}
|
| 33 |
+
]
|
| 34 |
+
},
|
| 35 |
+
]
|
| 36 |
+
pipe(text=messages)
|
| 37 |
with open('stepfun-ai_GELab-Zero-4B-preview_0.txt', 'w', encoding='utf-8') as f:
|
| 38 |
f.write('Everything was good in stepfun-ai_GELab-Zero-4B-preview_0.txt')
|
| 39 |
except Exception as e:
|
|
|
|
| 51 |
# Use a pipeline as a high-level helper
|
| 52 |
from transformers import pipeline
|
| 53 |
|
| 54 |
+
pipe = pipeline("image-text-to-text", model="stepfun-ai/GELab-Zero-4B-preview")
|
| 55 |
+
messages = [
|
| 56 |
+
{
|
| 57 |
+
"role": "user",
|
| 58 |
+
"content": [
|
| 59 |
+
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
|
| 60 |
+
{"type": "text", "text": "What animal is on the candy?"}
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
]
|
| 64 |
+
pipe(text=messages)
|
| 65 |
```
|
| 66 |
|
| 67 |
ERROR:
|