dragonjump commited on
Commit
9086f73
·
1 Parent(s): 0410591
Files changed (2) hide show
  1. README.md +31 -22
  2. main.py +1 -18
README.md CHANGED
@@ -8,13 +8,35 @@ pinned: false
8
  license: apache-2.0
9
  ---
10
 
 
 
 
 
 
 
 
 
11
  curl -X GET "http://localhost:8000/predict?image_url=https://example.com/sample-image.jpg&prompt=Describe%20the%20contents%20of%20this%20image." -H "accept: application/json"
12
 
13
  curl -X GET "http://localhost:8000/chat?prompt=Hello%20there%2C%20how%20are%20you%3F" -H "accept: application/json"
 
14
 
15
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
 
17
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
18
 
19
 
20
  curl -G "https://lseanlon-qwen25-api.hf.space/predict" \
@@ -23,8 +45,8 @@ curl -G "https://lseanlon-qwen25-api.hf.space/predict" \
23
 
24
 
25
 
26
-
27
-
28
 
29
  curl -G "https://lseanlon-qwen25-api.hf.space/" \
30
  --data-urlencode "image_url=https://huggingface.co/front/assets/huggingface_logo-noborder.svg" \
@@ -38,26 +60,13 @@ curl -G "https://lseanlon-qwen25-api.hf.space/predict" \
38
 
39
 
40
  curl -G "https://lseanlon-qwen25-api.hf.space/chat" \
41
- --data-urlencode "prompt=why is the sky blue?"
42
-
43
-
44
 
 
45
 
46
- FROM qwen2.5-coder:7b
47
- PARAMETER num_ctx 48000
48
-
49
- ollama create -f ZModelfile qwen2.5:latest-custom
50
 
51
- curl http://localhost:11434/api/chat -d '{
52
- "model": "qwen2.5:latest",
53
- "messages": [
54
- { "role": "user", "content": "why is the sky blue?" }
55
- ]
56
- }'
57
 
58
- curl https://dry-taxes-fold.loca.lt/api/chat -d '{
59
- "model": "qwen2.5:latest",
60
- "messages": [
61
- { "role": "user", "content": "why is the sky blue?" }
62
- ]
63
- }'
 
8
  license: apache-2.0
9
  ---
10
 
11
+ ## run locally
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
13
+
14
+ 1. ensure you have docker installed
15
+ 2. then run the docker image
16
+ 3. test it via endpoints below
17
+
18
+ ```
19
  curl -X GET "http://localhost:8000/predict?image_url=https://example.com/sample-image.jpg&prompt=Describe%20the%20contents%20of%20this%20image." -H "accept: application/json"
20
 
21
  curl -X GET "http://localhost:8000/chat?prompt=Hello%20there%2C%20how%20are%20you%3F" -H "accept: application/json"
22
+ ```
23
 
24
 
25
+ ## run after deploy
26
+
27
+ 1. qwen2.5vl - text prompt with image
28
+
29
+ 2. qwen2.5 - text prompt
30
+
31
+ 3. llama3 uncensored - text prompt
32
+
33
+
34
+
35
+ curl -G "https://<hf-username>-<hf-space-api>.hf.space/<your-python-api-path>" \
36
+ --data-urlencode "image_url=<url-to-some-image.jpg>" \
37
+ --data-urlencode "prompt=Describe this image."
38
+
39
 
 
40
 
41
 
42
  curl -G "https://lseanlon-qwen25-api.hf.space/predict" \
 
45
 
46
 
47
 
48
+ ### my personal example
49
+ ```
50
 
51
  curl -G "https://lseanlon-qwen25-api.hf.space/" \
52
  --data-urlencode "image_url=https://huggingface.co/front/assets/huggingface_logo-noborder.svg" \
 
60
 
61
 
62
  curl -G "https://lseanlon-qwen25-api.hf.space/chat" \
63
+ --data-urlencode "prompt=write controversial why the sky blue?"
 
 
64
 
65
+
66
 
67
+ curl -G "https://lseanlon-qwen25-api.hf.space/llama_chat" \
68
+ --data-urlencode "prompt=write controversial why the sky blue?"
 
 
69
 
70
+
 
 
 
 
 
71
 
72
+ ```
 
 
 
 
 
main.py CHANGED
@@ -13,24 +13,7 @@ import logging
13
  logging.basicConfig(level=logging.INFO)
14
 
15
  app = FastAPI()
16
-
17
- # Qwen2.5-VL Model Setup
18
- # qwen_checkpoint = "Qwen/Qwen2.5-VL-7B-Instruct"
19
- # min_pixels = 256 * 28 * 28
20
- # max_pixels = 1280 * 28 * 28
21
-
22
- # processor = AutoProcessor.from_pretrained(
23
- # qwen_checkpoint,
24
- # min_pixels=min_pixels,
25
- # max_pixels=max_pixels,
26
- # )
27
-
28
- # qwen_model = AutoModelForCausalLM.from_pretrained(
29
- # qwen_checkpoint,
30
- # torch_dtype=torch.bfloat16,
31
- # device_map="auto",
32
- # )
33
-
34
 
35
 
36
  checkpoint = "Qwen/Qwen2.5-VL-3B-Instruct"
 
13
  logging.basicConfig(level=logging.INFO)
14
 
15
  app = FastAPI()
16
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
 
19
  checkpoint = "Qwen/Qwen2.5-VL-3B-Instruct"