ariG23498 HF Staff commited on
Commit
2eb304c
·
verified ·
1 Parent(s): e088ef5

Upload Qwen_Qwen3-VL-8B-Instruct_3.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. Qwen_Qwen3-VL-8B-Instruct_3.py +2 -58
Qwen_Qwen3-VL-8B-Instruct_3.py CHANGED
@@ -12,35 +12,7 @@
12
 
13
  try:
14
  import os
15
- from openai import OpenAI
16
-
17
- client = OpenAI(
18
- base_url="https://router.huggingface.co/v1",
19
- api_key=os.environ["HF_TOKEN"],
20
- )
21
-
22
- completion = client.chat.completions.create(
23
- model="Qwen/Qwen3-VL-8B-Instruct",
24
- messages=[
25
- {
26
- "role": "user",
27
- "content": [
28
- {
29
- "type": "text",
30
- "text": "Describe this image in one sentence."
31
- },
32
- {
33
- "type": "image_url",
34
- "image_url": {
35
- "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
36
- }
37
- }
38
- ]
39
- }
40
- ],
41
- )
42
-
43
- print(completion.choices[0].message)
44
  with open('Qwen_Qwen3-VL-8B-Instruct_3.txt', 'w', encoding='utf-8') as f:
45
  f.write('Everything was good in Qwen_Qwen3-VL-8B-Instruct_3.txt')
46
  except Exception as e:
@@ -56,35 +28,7 @@ except Exception as e:
56
  import traceback
57
  f.write('''```CODE:
58
  import os
59
- from openai import OpenAI
60
-
61
- client = OpenAI(
62
- base_url="https://router.huggingface.co/v1",
63
- api_key=os.environ["HF_TOKEN"],
64
- )
65
-
66
- completion = client.chat.completions.create(
67
- model="Qwen/Qwen3-VL-8B-Instruct",
68
- messages=[
69
- {
70
- "role": "user",
71
- "content": [
72
- {
73
- "type": "text",
74
- "text": "Describe this image in one sentence."
75
- },
76
- {
77
- "type": "image_url",
78
- "image_url": {
79
- "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg"
80
- }
81
- }
82
- ]
83
- }
84
- ],
85
- )
86
-
87
- print(completion.choices[0].message)
88
  ```
89
 
90
  ERROR:
 
12
 
13
  try:
14
  import os
15
+ os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  with open('Qwen_Qwen3-VL-8B-Instruct_3.txt', 'w', encoding='utf-8') as f:
17
  f.write('Everything was good in Qwen_Qwen3-VL-8B-Instruct_3.txt')
18
  except Exception as e:
 
28
  import traceback
29
  f.write('''```CODE:
30
  import os
31
+ os.environ['HF_TOKEN'] = 'YOUR_TOKEN_HERE'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  ```
33
 
34
  ERROR: