micro-learn / app.py
ldrissi's picture
refactor: remove unused imports and clarify decorator usage in calculator function
ce5ae80
# Super minimal app.py for troubleshooting
import gradio as gr
import sys
# Print Python version and loaded modules for debugging
print(f"Python version: {sys.version}")
print("Loaded modules:")
for name, module in sys.modules.items():
if hasattr(module, "__version__"):
print(f" {name}: {module.__version__}")
# Simple function that doesn't require any ML models
def echo(text):
return f"You said: {text}"
# @tool # This decorator's origin is unclear or its library is not imported.
# If it's from a library like langchain, ensure it's installed and imported.
# For a minimal example, it's safer to remove it if its definition isn't present.
def calculator(a: int, b: int) -> int:
"""Multiply two integers."""
return a * b
# Create a simple Gradio interface
demo = gr.Interface(
fn=calculator,
inputs=[gr.Number(label="First Number (a)"), gr.Number(label="Second Number (b)")],
outputs=gr.Number(label="Result (a * b)"),
title="Micro Learning Platform - Debug Version",
description="This is a minimal version for troubleshooting"
)
# Add a clear print statement when the app starts
print("Application starting...")
# Launch the application
if __name__ == "__main__":
demo.launch()
print("Application launched successfully!")