Upload stepfun-ai_step3_0.py with huggingface_hub
Browse files- stepfun-ai_step3_0.py +9 -3
stepfun-ai_step3_0.py
CHANGED
|
@@ -10,11 +10,17 @@ try:
|
|
| 10 |
# Use a pipeline as a high-level helper
|
| 11 |
from transformers import pipeline
|
| 12 |
|
| 13 |
-
pipe = pipeline("text-
|
| 14 |
messages = [
|
| 15 |
-
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 16 |
]
|
| 17 |
-
pipe(messages)
|
| 18 |
with open('stepfun-ai_step3_0.txt', 'w') as f:
|
| 19 |
f.write('Everything was good in stepfun-ai_step3_0.txt')
|
| 20 |
except Exception as e:
|
|
|
|
| 10 |
# Use a pipeline as a high-level helper
|
| 11 |
from transformers import pipeline
|
| 12 |
|
| 13 |
+
pipe = pipeline("image-text-to-text", model="stepfun-ai/step3", trust_remote_code=True)
|
| 14 |
messages = [
|
| 15 |
+
{
|
| 16 |
+
"role": "user",
|
| 17 |
+
"content": [
|
| 18 |
+
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
|
| 19 |
+
{"type": "text", "text": "What animal is on the candy?"}
|
| 20 |
+
]
|
| 21 |
+
},
|
| 22 |
]
|
| 23 |
+
pipe(text=messages)
|
| 24 |
with open('stepfun-ai_step3_0.txt', 'w') as f:
|
| 25 |
f.write('Everything was good in stepfun-ai_step3_0.txt')
|
| 26 |
except Exception as e:
|