Commit ·
6e514e4
verified ·
0
Parent(s):
initial commit
Browse files- .gitattributes +35 -0
- README.md +12 -0
- app.py +111 -0
- requirements.txt +1 -0
.gitattributes
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.7z filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
*.arrow filter=lfs diff=lfs merge=lfs -text
|
| 3 |
+
*.bin filter=lfs diff=lfs merge=lfs -text
|
| 4 |
+
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
| 5 |
+
*.ckpt filter=lfs diff=lfs merge=lfs -text
|
| 6 |
+
*.ftz filter=lfs diff=lfs merge=lfs -text
|
| 7 |
+
*.gz filter=lfs diff=lfs merge=lfs -text
|
| 8 |
+
*.h5 filter=lfs diff=lfs merge=lfs -text
|
| 9 |
+
*.joblib filter=lfs diff=lfs merge=lfs -text
|
| 10 |
+
*.lfs.* filter=lfs diff=lfs merge=lfs -text
|
| 11 |
+
*.mlmodel filter=lfs diff=lfs merge=lfs -text
|
| 12 |
+
*.model filter=lfs diff=lfs merge=lfs -text
|
| 13 |
+
*.msgpack filter=lfs diff=lfs merge=lfs -text
|
| 14 |
+
*.npy filter=lfs diff=lfs merge=lfs -text
|
| 15 |
+
*.npz filter=lfs diff=lfs merge=lfs -text
|
| 16 |
+
*.onnx filter=lfs diff=lfs merge=lfs -text
|
| 17 |
+
*.ot filter=lfs diff=lfs merge=lfs -text
|
| 18 |
+
*.parquet filter=lfs diff=lfs merge=lfs -text
|
| 19 |
+
*.pb filter=lfs diff=lfs merge=lfs -text
|
| 20 |
+
*.pickle filter=lfs diff=lfs merge=lfs -text
|
| 21 |
+
*.pkl filter=lfs diff=lfs merge=lfs -text
|
| 22 |
+
*.pt filter=lfs diff=lfs merge=lfs -text
|
| 23 |
+
*.pth filter=lfs diff=lfs merge=lfs -text
|
| 24 |
+
*.rar filter=lfs diff=lfs merge=lfs -text
|
| 25 |
+
*.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 26 |
+
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
| 27 |
+
*.tar.* filter=lfs diff=lfs merge=lfs -text
|
| 28 |
+
*.tar filter=lfs diff=lfs merge=lfs -text
|
| 29 |
+
*.tflite filter=lfs diff=lfs merge=lfs -text
|
| 30 |
+
*.tgz filter=lfs diff=lfs merge=lfs -text
|
| 31 |
+
*.wasm filter=lfs diff=lfs merge=lfs -text
|
| 32 |
+
*.xz filter=lfs diff=lfs merge=lfs -text
|
| 33 |
+
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
+
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
README.md
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: WebUI
|
| 3 |
+
emoji: 📊
|
| 4 |
+
colorFrom: yellow
|
| 5 |
+
colorTo: pink
|
| 6 |
+
sdk: gradio
|
| 7 |
+
sdk_version: 5.4.0
|
| 8 |
+
app_file: app.py
|
| 9 |
+
pinned: false
|
| 10 |
+
---
|
| 11 |
+
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
app.py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import numpy as np
|
| 3 |
+
|
| 4 |
+
# Define the function to handle the image editor
|
| 5 |
+
def handle_image_editor(image):
|
| 6 |
+
# Placeholder function to handle the image editor
|
| 7 |
+
return image
|
| 8 |
+
|
| 9 |
+
# Define the function to handle the chatbox
|
| 10 |
+
def handle_chatbox(message, history):
|
| 11 |
+
# Placeholder function to handle the chatbox
|
| 12 |
+
response = "Echo: " + message
|
| 13 |
+
history.append({"role": "user", "content": message})
|
| 14 |
+
history.append({"role": "assistant", "content": response})
|
| 15 |
+
return "", history
|
| 16 |
+
|
| 17 |
+
# Define the function to handle the prompt box
|
| 18 |
+
def handle_prompt_box(prompt, image_generation, checkboxes, slider):
|
| 19 |
+
# Placeholder function to handle the prompt box
|
| 20 |
+
return f"Prompt: {prompt}, Image Generation: {image_generation}, Checkboxes: {checkboxes}, Slider: {slider}"
|
| 21 |
+
|
| 22 |
+
# Define the function to handle the model and API accordions
|
| 23 |
+
def handle_accordions(model, api, settings):
|
| 24 |
+
# Placeholder function to handle the model and API accordions
|
| 25 |
+
return f"Model: {model}, API: {api}, Settings: {settings}"
|
| 26 |
+
|
| 27 |
+
# Define the main Gradio app
|
| 28 |
+
with gr.Blocks(css="""
|
| 29 |
+
:root {
|
| 30 |
+
--primary-800: #1f2937;
|
| 31 |
+
--secondary-500: #3b82f6;
|
| 32 |
+
--text-color: #000000;
|
| 33 |
+
--radius-sm: 8px;
|
| 34 |
+
}
|
| 35 |
+
.gr-button {
|
| 36 |
+
background-color: var(--secondary-500);
|
| 37 |
+
color: var(--text-color);
|
| 38 |
+
border-radius: var(--radius-sm);
|
| 39 |
+
}
|
| 40 |
+
.gr-button:hover {
|
| 41 |
+
background-color: #2563eb;
|
| 42 |
+
}
|
| 43 |
+
.gr-button:active {
|
| 44 |
+
background-color: #1d4ed8;
|
| 45 |
+
}
|
| 46 |
+
.gr-button:disabled {
|
| 47 |
+
background-color: #c7d2fe;
|
| 48 |
+
color: #6b7280;
|
| 49 |
+
}
|
| 50 |
+
.gr-button--icon {
|
| 51 |
+
padding: 0.5rem;
|
| 52 |
+
}
|
| 53 |
+
.gr-button--icon img {
|
| 54 |
+
width: 1rem;
|
| 55 |
+
height: 1rem;
|
| 56 |
+
}
|
| 57 |
+
.gr-image-editor {
|
| 58 |
+
border: 1px solid var(--secondary-500);
|
| 59 |
+
border-radius: var(--radius-sm);
|
| 60 |
+
}
|
| 61 |
+
.gr-gallery {
|
| 62 |
+
border: 1px solid var(--secondary-500);
|
| 63 |
+
border-radius: var(--radius-sm);
|
| 64 |
+
}
|
| 65 |
+
.gr-chatbot {
|
| 66 |
+
border: 1px solid var(--secondary-500);
|
| 67 |
+
border-radius: var(--radius-sm);
|
| 68 |
+
}
|
| 69 |
+
.gr-accordion {
|
| 70 |
+
border: 1px solid var(--secondary-500);
|
| 71 |
+
border-radius: var(--radius-sm);
|
| 72 |
+
}
|
| 73 |
+
""") as demo:
|
| 74 |
+
# Top left: 3x Buttons with image icon
|
| 75 |
+
with gr.Row():
|
| 76 |
+
with gr.Column():
|
| 77 |
+
hamburger_btn = gr.Button("Hamburger", elem_classes="gr-button--icon")
|
| 78 |
+
hamburger_btn.click(lambda: gr.Info("Hamburger button clicked"), None, None)
|
| 79 |
+
color_picker = gr.ColorPicker(value="#3b82f6", label="Color Picker", show_label=False)
|
| 80 |
+
toggle_dark = gr.Button("Toggle Dark", elem_classes="gr-button--icon")
|
| 81 |
+
toggle_dark.click(lambda: gr.Info("Dark mode toggled"), None, None)
|
| 82 |
+
|
| 83 |
+
# Main body: square boxes
|
| 84 |
+
with gr.Row():
|
| 85 |
+
with gr.Column():
|
| 86 |
+
image_editor = gr.ImageEditor(type="numpy", label="Image Editor", show_download_button=True)
|
| 87 |
+
image = gr.Image(type="numpy", label="Image", show_download_button=True)
|
| 88 |
+
gallery = gr.Gallery(columns=4, label="Gallery", show_download_button=True)
|
| 89 |
+
|
| 90 |
+
# Bottom: Chat box with switch
|
| 91 |
+
with gr.Row():
|
| 92 |
+
with gr.Column():
|
| 93 |
+
chatbox = gr.Chatbot(type="messages", label="Chatbox")
|
| 94 |
+
msg = gr.Textbox(label="Message")
|
| 95 |
+
msg.submit(handle_chatbox, [msg, chatbox], [msg, chatbox])
|
| 96 |
+
|
| 97 |
+
# Bottom: Prompt box with switch
|
| 98 |
+
with gr.Row():
|
| 99 |
+
with gr.Column():
|
| 100 |
+
prompt_box = gr.Textbox(label="Prompt")
|
| 101 |
+
image_generation = gr.Checkbox(label="Image Generation")
|
| 102 |
+
checkboxes = gr.CheckboxGroup(["Checkbox 1", "Checkbox 2", "Checkbox 3"], label="Checkboxes")
|
| 103 |
+
slider = gr.Slider(0, 100, step=1, label="Slider")
|
| 104 |
+
prompt_box.submit(handle_prompt_box, [prompt_box, image_generation, checkboxes, slider], None)
|
| 105 |
+
|
| 106 |
+
# Bottom: Model, API, and Settings accordions
|
| 107 |
+
with gr.Row():
|
| 108 |
+
with gr.Column():
|
| 109 |
+
model_accordion = gr.Accordion("Model", open=False)
|
| 110 |
+
with model_accordion:
|
| 111 |
+
model
|
requirements.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
numpy
|