Skip to content

Very simple http server #367

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a6f6e5d
Add server example
stduhpf Aug 25, 2024
ce76dec
server: remove pingpong endpoint
stduhpf Aug 26, 2024
377a2d1
Server: Fix missing return on non-void function
stduhpf Aug 27, 2024
d018c23
Server: change default host
stduhpf Aug 27, 2024
1b91a09
Server: Fix printf
stduhpf Aug 27, 2024
d22ef24
server: move httplib to thirdparty folder
stduhpf Oct 4, 2024
eb239ba
Server: accept json inputs + return bas64 image
stduhpf Oct 4, 2024
b61fce8
server: use t.join() instead of infinite loop
stduhpf Oct 4, 2024
559f205
server: fix CI Build
stduhpf Oct 4, 2024
8b83616
server: attach image metadata in response
stduhpf Oct 5, 2024
bf69f5a
server: add simple client script
stduhpf Oct 5, 2024
b128c41
Server: add client docstrings
stduhpf Oct 5, 2024
897df4c
server: client: fix image preview on non-windows os
stduhpf Oct 5, 2024
5c7d32f
server: support sampling method arg
stduhpf Oct 6, 2024
45ca9bb
server: small test client fixes
stduhpf Oct 5, 2024
b5772ae
Try adding photomaker support
stduhpf Oct 22, 2024
4e651e2
server: update
stduhpf Nov 25, 2024
9bce34c
server: update and refacor (add queue)
stduhpf Jan 2, 2025
f9b2a6d
server: update samplers and schedulers
stduhpf Jan 2, 2025
578ae14
global running task_id
stduhpf Jan 2, 2025
c9e46e2
basic webui
stduhpf Jan 2, 2025
8d725e7
Make server ui better
stduhpf Jan 3, 2025
476a66f
Fixes
stduhpf Jan 3, 2025
15bd894
Frontend: dirty queue display
stduhpf Jan 3, 2025
320bbb9
server: do not block when loading
stduhpf Jan 3, 2025
d1b8f67
server: fix queue
stduhpf Jan 4, 2025
57843fc
server: allow to unload model components
stduhpf Jan 4, 2025
4d02f39
Frontend: qol
stduhpf Jan 4, 2025
a1e82ec
Use progress_callback
stduhpf Jan 4, 2025
4a1fb94
update progress bars (+fixes)
stduhpf Jan 5, 2025
226caf0
frontend.cpp: use relative paths in fetch() (#4) (cherry-picked)
mord0d Jul 10, 2025
bcba77c
rebaseon master and apply api changes
stduhpf Jul 10, 2025
febe7b5
server: update api
stduhpf Jul 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include_directories(${CMAKE_CURRENT_SOURCE_DIR})

add_subdirectory(cli)
add_subdirectory(cli)
add_subdirectory(server)
6 changes: 6 additions & 0 deletions examples/server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
set(TARGET sd-server)

add_executable(${TARGET} main.cpp)
install(TARGETS ${TARGET} RUNTIME)
target_link_libraries(${TARGET} PRIVATE stable-diffusion ${CMAKE_THREAD_LIBS_INIT})
target_compile_features(${TARGET} PUBLIC cxx_std_17)
42 changes: 42 additions & 0 deletions examples/server/b64.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

//FROM
//https://stackoverflow.com/a/34571089/5155484

static const std::string b = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";//=
static std::string base64_encode(const std::string &in) {
std::string out;

int val=0, valb=-6;
for (uint8_t c : in) {
val = (val<<8) + c;
valb += 8;
while (valb>=0) {
out.push_back(b[(val>>valb)&0x3F]);
valb-=6;
}
}
if (valb>-6) out.push_back(b[((val<<8)>>(valb+8))&0x3F]);
while (out.size()%4) out.push_back('=');
return out;
}


static std::string base64_decode(const std::string &in) {

std::string out;

std::vector<int> T(256,-1);
for (int i=0; i<64; i++) T[b[i]] = i;

int val=0, valb=-8;
for (uint8_t c : in) {
if (T[c] == -1) break;
val = (val<<6) + T[c];
valb += 6;
if (valb>=0) {
out.push_back(char((val>>valb)&0xFF));
valb-=8;
}
}
return out;
}
Loading
Loading