Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
|
@@ -18,6 +18,14 @@ logger.info(f"HF_TOKEN configured: {bool(HF_TOKEN)}")
|
|
| 18 |
client = InferenceClient(token=HF_TOKEN) if HF_TOKEN else InferenceClient()
|
| 19 |
logger.info("InferenceClient initialized")
|
| 20 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
def caption_image(image):
|
| 23 |
"""Generate a caption for the image."""
|
|
@@ -68,7 +76,7 @@ def answer_question(image, question: str):
|
|
| 68 |
|
| 69 |
logger.info("Building Gradio interface...")
|
| 70 |
|
| 71 |
-
with gr.Blocks(title="Vision Chat") as demo:
|
| 72 |
gr.Markdown("# 👁️ Vision Chat\nUpload an image, get a caption, and ask questions about it!")
|
| 73 |
|
| 74 |
with gr.Row(equal_height=True):
|
|
|
|
| 18 |
client = InferenceClient(token=HF_TOKEN) if HF_TOKEN else InferenceClient()
|
| 19 |
logger.info("InferenceClient initialized")
|
| 20 |
|
| 21 |
+
# Dark mode JS
|
| 22 |
+
DARK_MODE_JS = """
|
| 23 |
+
function() {
|
| 24 |
+
document.body.classList.add('dark');
|
| 25 |
+
document.querySelector('gradio-app').style.backgroundColor = 'var(--background-fill-primary)';
|
| 26 |
+
}
|
| 27 |
+
"""
|
| 28 |
+
|
| 29 |
|
| 30 |
def caption_image(image):
|
| 31 |
"""Generate a caption for the image."""
|
|
|
|
| 76 |
|
| 77 |
logger.info("Building Gradio interface...")
|
| 78 |
|
| 79 |
+
with gr.Blocks(title="Vision Chat", theme=gr.themes.Soft(primary_hue="purple"), js=DARK_MODE_JS) as demo:
|
| 80 |
gr.Markdown("# 👁️ Vision Chat\nUpload an image, get a caption, and ask questions about it!")
|
| 81 |
|
| 82 |
with gr.Row(equal_height=True):
|