Skip to content
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

Very simple http server #367

Draft
wants to merge 30 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
af9b4d0
Add server example
stduhpf Aug 25, 2024
fba3a2c
server: remove pingpong endpoint
stduhpf Aug 26, 2024
59511ee
Server: Fix missing return on non-void function
stduhpf Aug 27, 2024
67428d7
Server: change default host
stduhpf Aug 27, 2024
1bd5cbf
Server: Fix printf
stduhpf Aug 27, 2024
b2dfb46
server: move httplib to thirdparty folder
stduhpf Oct 4, 2024
f5d658f
Server: accept json inputs + return bas64 image
stduhpf Oct 4, 2024
798f3ba
server: use t.join() instead of infinite loop
stduhpf Oct 4, 2024
0588a64
server: fix CI Build
stduhpf Oct 4, 2024
63f5aae
server: attach image metadata in response
stduhpf Oct 5, 2024
44ddb69
server: add simple client script
stduhpf Oct 5, 2024
ca37d64
Server: add client docstrings
stduhpf Oct 5, 2024
f900910
server: client: fix image preview on non-windows os
stduhpf Oct 5, 2024
9ac79a2
server: support sampling method arg
stduhpf Oct 6, 2024
81fcfca
server: small test client fixes
stduhpf Oct 5, 2024
6c19221
Try adding photomaker support
stduhpf Oct 22, 2024
b8b734e
server: update
stduhpf Nov 25, 2024
0d1f338
server: update and refacor (add queue)
stduhpf Jan 2, 2025
e9507f2
server: update samplers and schedulers
stduhpf Jan 2, 2025
b9cb645
global running task_id
stduhpf Jan 2, 2025
d9de0a5
basic webui
stduhpf Jan 2, 2025
c39743c
Make server ui better
stduhpf Jan 3, 2025
d5d684a
Fixes
stduhpf Jan 3, 2025
ade7f92
Frontend: dirty queue display
stduhpf Jan 3, 2025
b92e61f
server: do not block when loading
stduhpf Jan 3, 2025
549a780
server: fix queue
stduhpf Jan 4, 2025
31a013d
server: allow to unload model components
stduhpf Jan 4, 2025
cfdb792
Frontend: qol
stduhpf Jan 4, 2025
817b854
Use progress_callback
stduhpf Jan 4, 2025
b543ec3
update progress bars (+fixes)
stduhpf Jan 5, 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