CrimsonElephant's picture
Deploying minimal Gradio app for environment test
d9a2932
import gradio as gr
import os # Keep os import for potential future use if needed for environment variables
import traceback # Keep traceback for general error logging
if __name__ == "__main__":
try:
print("--- Minimal Gradio App Starting ---")
def greet(name):
print(f"Greet function called with: {name}")
return "Hello " + name + "!"
print("Creating Gradio interface...")
with gr.Blocks() as demo:
gr.Markdown("## Minimal Test App")
gr.Interface(
fn=greet,
inputs=gr.Textbox(lines=1, placeholder="Enter your name..."),
outputs="text",
title="Simple Greeter",
description="A minimal Gradio app to test deployment."
)
print("Launching Minimal Gradio app...")
# Ensure share=True for Hugging Face Spaces deployment
demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
print("Minimal Gradio launch command executed. Check UI.")
except Exception as e:
print("\n\n--- CRITICAL APPLICATION ERROR (Minimal App) ---\n")
print("The minimal application failed to start due to an unhandled exception.")
print("Printing the full traceback below:")
traceback.print_exc()
print("\n-------------------------------------------------\n")