finclaude / app.py
Starfish55's picture
Upload 6 files
e0637d2 verified
raw
history blame contribute delete
916 Bytes
import importlib
import gradio as gr
_module = importlib.import_module('app_claude_41')
# Expose a Gradio Blocks/Interface as `demo` at module scope for Spaces
# Try common names or build via factory
demo = None
for attr_name in ('demo', 'app', 'iface', 'interface'):
if hasattr(_module, attr_name):
demo = getattr(_module, attr_name)
break
if demo is None:
for factory_name in ('create_demo', 'build_demo', 'get_demo'):
if hasattr(_module, factory_name):
demo = getattr(_module, factory_name)()
break
# Ultimate fallback to avoid uninitialized app in Spaces
if demo is None:
def _fallback_echo(text: str) -> str:
return f"Fallback active. Received: {text}"
demo = gr.Interface(fn=_fallback_echo, inputs=gr.Textbox(label='Input'), outputs=gr.Textbox(label='Output'), title='Fallback Demo')
if __name__ == '__main__':
demo.launch()