Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
C
Chart Analyzer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zeinab.rostom
Chart Analyzer
Commits
99189ddd
Commit
99189ddd
authored
Jul 23, 2025
by
ZeinabRm13
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Analyze service
parent
a65289d8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
32 deletions
+0
-32
test.py
test.py
+0
-32
No files found.
test.py
View file @
99189ddd
# 1. Install required package
# pip install huggingface-hub
# 2. Import and initialize
from
huggingface_hub
import
InferenceClient
import
base64
import
requests
# 1. Convert image to base64
with
open
(
"/home/zeinabrm/Pictures/Screenshots/Screenshot from 2025-02-17 22-46-46.png"
,
"rb"
)
as
image_file
:
base64_image
=
base64
.
b64encode
(
image_file
.
read
())
.
decode
(
'utf-8'
)
# 2. Prepare payload
headers
=
{
"Authorization"
:
f
"Bearer REPLACED"
,
"Content-Type"
:
"application2/json"
}
payload
=
{
"inputs"
:
f
"<image>{base64_image}</image>
\n
Question: What does this chart show?
\n
Answer:"
,
"parameters"
:
{
"max_new_tokens"
:
200
}
}
# 3. Manually call the API
response
=
requests
.
post
(
"https://api-inference.huggingface.co/yuan-tian/chartgpt-llama3"
,
headers
=
headers
,
json
=
payload
)
print
(
f
"Status Code: {response.status_code}"
)
print
(
f
"Raw Response: {response.text}"
)
print
(
response
.
json
())
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment