Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -407,6 +407,17 @@ def load_text_examples():
|
|
407 |
|
408 |
return examples
|
409 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
410 |
# CSS for improved UI
|
411 |
css = """
|
412 |
:root {
|
@@ -588,11 +599,8 @@ with gr.Blocks(css=css) as demo:
|
|
588 |
</div>
|
589 |
""")
|
590 |
|
591 |
-
# API Status
|
592 |
-
api_status = gr.Markdown(
|
593 |
-
"""<div class="api-status api-connected">✓ Connected to image generation and Gemini API</div>""",
|
594 |
-
visible=True
|
595 |
-
)
|
596 |
|
597 |
with gr.Tabs():
|
598 |
with gr.Tab("Create Ghibli Art"):
|
@@ -774,19 +782,5 @@ with gr.Blocks(css=css) as demo:
|
|
774 |
</div>
|
775 |
""")
|
776 |
|
777 |
-
# Function to check API availability
|
778 |
-
def check_api_status():
|
779 |
-
# Check Gemini API availability
|
780 |
-
api_key = os.getenv("GAPI_TOKEN")
|
781 |
-
gemini_available = api_key is not None
|
782 |
-
|
783 |
-
if gemini_available:
|
784 |
-
return """<div class="api-status api-connected">✓ Connected to FLUX.1 and Gemini API</div>"""
|
785 |
-
else:
|
786 |
-
return """<div class="api-status api-disconnected">✗ Gemini API connection issue. Please check GAPI_TOKEN environment variable.</div>"""
|
787 |
-
|
788 |
-
# Update API status on page load
|
789 |
-
demo.load(fn=check_api_status, outputs=api_status)
|
790 |
-
|
791 |
# Launch the Gradio app
|
792 |
demo.queue().launch()
|
|
|
407 |
|
408 |
return examples
|
409 |
|
410 |
+
# Function to check API availability - modified to work directly
|
411 |
+
def check_api_status():
|
412 |
+
# Check Gemini API availability
|
413 |
+
api_key = os.getenv("GAPI_TOKEN")
|
414 |
+
gemini_available = api_key is not None
|
415 |
+
|
416 |
+
if gemini_available:
|
417 |
+
return """<div class="api-status api-connected">✓ Connected to FLUX.1 and Gemini API</div>"""
|
418 |
+
else:
|
419 |
+
return """<div class="api-status api-disconnected">✗ Gemini API connection issue. Please check GAPI_TOKEN environment variable.</div>"""
|
420 |
+
|
421 |
# CSS for improved UI
|
422 |
css = """
|
423 |
:root {
|
|
|
599 |
</div>
|
600 |
""")
|
601 |
|
602 |
+
# API Status - 직접 호출해서 초기 상태 설정
|
603 |
+
api_status = gr.Markdown(check_api_status(), visible=True)
|
|
|
|
|
|
|
604 |
|
605 |
with gr.Tabs():
|
606 |
with gr.Tab("Create Ghibli Art"):
|
|
|
782 |
</div>
|
783 |
""")
|
784 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
785 |
# Launch the Gradio app
|
786 |
demo.queue().launch()
|