File size: 1,390 Bytes
86f2022
d9a2932
 
263b899
2b4824e
 
d9a2932
71d91cd
d9a2932
 
 
263b899
2b4824e
 
d9a2932
2b4824e
d9a2932
 
2b4824e
d9a2932
 
2b4824e
86f2022
d9a2932
 
2b4824e
d9a2932
2b4824e
 
d9a2932
 
2b4824e
 
d9a2932
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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")