Spaces:
Sleeping
Sleeping
IDAgents Developer
commited on
Commit
·
1a01a01
1
Parent(s):
cc8b97c
Troubleshoot: Add simplified test app and fix Gradio version mismatch
Browse files- README.md +1 -1
- app_simple_test.py +121 -0
- requirements.txt +9 -33
- test_basic.py +40 -0
README.md
CHANGED
|
@@ -5,7 +5,7 @@ colorFrom: blue
|
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.20.0
|
| 8 |
-
app_file:
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
visibility: unlisted
|
|
|
|
| 5 |
colorTo: green
|
| 6 |
sdk: gradio
|
| 7 |
sdk_version: 4.20.0
|
| 8 |
+
app_file: app_simple_test.py
|
| 9 |
pinned: false
|
| 10 |
license: mit
|
| 11 |
visibility: unlisted
|
app_simple_test.py
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Simplified ID Agents App for Troubleshooting
|
| 4 |
+
This version isolates potential import issues and provides basic functionality
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
import gradio as gr
|
| 8 |
+
import json
|
| 9 |
+
import os
|
| 10 |
+
|
| 11 |
+
# Simple authentication test
|
| 12 |
+
def create_simple_app():
|
| 13 |
+
"""Create a simplified version of the ID Agents app"""
|
| 14 |
+
|
| 15 |
+
with gr.Blocks(title="ID Agents - Test Version") as app:
|
| 16 |
+
|
| 17 |
+
# Custom CSS (minimal)
|
| 18 |
+
app.css = """
|
| 19 |
+
.main-container {
|
| 20 |
+
max-width: 1200px;
|
| 21 |
+
margin: 0 auto;
|
| 22 |
+
padding: 20px;
|
| 23 |
+
}
|
| 24 |
+
"""
|
| 25 |
+
|
| 26 |
+
# Header
|
| 27 |
+
gr.Markdown("# 🦠 ID Agents - Test Version")
|
| 28 |
+
gr.Markdown("This is a simplified version to test basic functionality and authentication.")
|
| 29 |
+
|
| 30 |
+
# Simple chat interface
|
| 31 |
+
with gr.Row():
|
| 32 |
+
with gr.Column(scale=1):
|
| 33 |
+
gr.Markdown("### Quick Test Panel")
|
| 34 |
+
test_input = gr.Textbox(label="Test Input", placeholder="Type a message...")
|
| 35 |
+
test_btn = gr.Button("Send Test")
|
| 36 |
+
|
| 37 |
+
with gr.Column(scale=2):
|
| 38 |
+
gr.Markdown("### Chat Test")
|
| 39 |
+
chatbot = gr.Chatbot(label="Test Chat")
|
| 40 |
+
|
| 41 |
+
# Simple function
|
| 42 |
+
def test_response(message):
|
| 43 |
+
if not message.strip():
|
| 44 |
+
return [["", "Please enter a message to test."]]
|
| 45 |
+
|
| 46 |
+
response = f"✅ Test successful! You said: '{message}'"
|
| 47 |
+
return [["Test User", message], ["ID Agents Test", response]]
|
| 48 |
+
|
| 49 |
+
# Connect the function
|
| 50 |
+
test_btn.click(
|
| 51 |
+
test_response,
|
| 52 |
+
inputs=[test_input],
|
| 53 |
+
outputs=[chatbot]
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
# Footer
|
| 57 |
+
gr.Markdown("---")
|
| 58 |
+
gr.Markdown("🧪 **Test Status**: If you can see this interface and interact with it, the basic setup is working!")
|
| 59 |
+
|
| 60 |
+
return app
|
| 61 |
+
|
| 62 |
+
def main():
|
| 63 |
+
"""Main function with authentication"""
|
| 64 |
+
print("🧪 Starting ID Agents Test Version...")
|
| 65 |
+
|
| 66 |
+
# Create the app
|
| 67 |
+
try:
|
| 68 |
+
app = create_simple_app()
|
| 69 |
+
print("✅ App created successfully")
|
| 70 |
+
except Exception as e:
|
| 71 |
+
print(f"❌ Failed to create app: {e}")
|
| 72 |
+
return
|
| 73 |
+
|
| 74 |
+
# Authentication credentials (simplified)
|
| 75 |
+
auth_credentials = [
|
| 76 |
+
("test", "test123"),
|
| 77 |
+
("admin", "admin123"),
|
| 78 |
+
("dr_smith", "idweek2025"),
|
| 79 |
+
("guest", "guest123")
|
| 80 |
+
]
|
| 81 |
+
|
| 82 |
+
auth_message = """
|
| 83 |
+
🧪 **ID Agents Test Version**
|
| 84 |
+
|
| 85 |
+
Test credentials:
|
| 86 |
+
• test / test123
|
| 87 |
+
• admin / admin123
|
| 88 |
+
• dr_smith / idweek2025
|
| 89 |
+
• guest / guest123
|
| 90 |
+
"""
|
| 91 |
+
|
| 92 |
+
# Launch configuration
|
| 93 |
+
launch_config = {
|
| 94 |
+
"auth": auth_credentials,
|
| 95 |
+
"auth_message": auth_message,
|
| 96 |
+
"server_name": "0.0.0.0",
|
| 97 |
+
"server_port": 7860,
|
| 98 |
+
"share": False,
|
| 99 |
+
"show_error": True
|
| 100 |
+
}
|
| 101 |
+
|
| 102 |
+
print("🔐 Authentication enabled")
|
| 103 |
+
print("🚀 Launching app...")
|
| 104 |
+
|
| 105 |
+
try:
|
| 106 |
+
app.launch(**launch_config)
|
| 107 |
+
except Exception as e:
|
| 108 |
+
print(f"❌ Failed to launch app: {e}")
|
| 109 |
+
# Try without authentication as fallback
|
| 110 |
+
print("🔄 Trying without authentication...")
|
| 111 |
+
try:
|
| 112 |
+
app.launch(
|
| 113 |
+
server_name="0.0.0.0",
|
| 114 |
+
server_port=7860,
|
| 115 |
+
share=False
|
| 116 |
+
)
|
| 117 |
+
except Exception as e2:
|
| 118 |
+
print(f"❌ Complete failure: {e2}")
|
| 119 |
+
|
| 120 |
+
if __name__ == "__main__":
|
| 121 |
+
main()
|
requirements.txt
CHANGED
|
@@ -1,15 +1,14 @@
|
|
| 1 |
# ID Agents Production Requirements
|
| 2 |
-
# Updated: 2025-08-
|
| 3 |
# Python 3.12.7
|
| 4 |
-
#
|
| 5 |
-
# This file contains pinned versions for reproducible deployments
|
| 6 |
-
# Tested and verified working in development environment
|
| 7 |
|
| 8 |
-
# Core
|
| 9 |
-
openai>=1.3.0
|
| 10 |
gradio==4.20.0
|
| 11 |
|
| 12 |
-
#
|
|
|
|
|
|
|
|
|
|
| 13 |
pandas>=2.0.0
|
| 14 |
numpy>=1.24.0
|
| 15 |
|
|
@@ -21,40 +20,17 @@ python-docx
|
|
| 21 |
requests>=2.31.0
|
| 22 |
duckduckgo-search>=4.0.0
|
| 23 |
|
| 24 |
-
# Configuration
|
| 25 |
python-dotenv>=1.0.0
|
| 26 |
|
| 27 |
# Authentication & Security
|
| 28 |
bcrypt>=4.0.0
|
| 29 |
-
PyJWT>=2.8.0
|
| 30 |
|
| 31 |
-
# Logging
|
| 32 |
structlog>=23.0.0
|
| 33 |
|
| 34 |
# Template Processing
|
| 35 |
jinja2
|
| 36 |
|
| 37 |
-
#
|
| 38 |
-
matplotlib>=3.5.0
|
| 39 |
-
|
| 40 |
-
# Advanced AI Libraries (optional - enable for enhanced features)
|
| 41 |
-
# Uncomment the following if you need advanced AI capabilities:
|
| 42 |
-
# transformers
|
| 43 |
-
# langchain
|
| 44 |
-
# autogen
|
| 45 |
-
# llama_index
|
| 46 |
-
# farm-haystack
|
| 47 |
-
# faiss-cpu
|
| 48 |
-
|
| 49 |
-
# Development & Testing (optional - remove for production)
|
| 50 |
-
# pytest
|
| 51 |
-
|
| 52 |
-
# Load Testing Dependencies
|
| 53 |
-
aiohttp>=3.8.0
|
| 54 |
psutil>=5.9.0
|
| 55 |
-
|
| 56 |
-
# Notes:
|
| 57 |
-
# - All core dependencies use minimum version pinning (>=)
|
| 58 |
-
# - Advanced AI libraries are commented out to reduce deployment size
|
| 59 |
-
# - Uncomment additional libraries as needed for specific features
|
| 60 |
-
# - For strict version pinning, replace >= with == and specific versions
|
|
|
|
| 1 |
# ID Agents Production Requirements
|
| 2 |
+
# Updated: 2025-08-27
|
| 3 |
# Python 3.12.7
|
|
|
|
|
|
|
|
|
|
| 4 |
|
| 5 |
+
# Core Framework - aligned with HF Spaces
|
|
|
|
| 6 |
gradio==4.20.0
|
| 7 |
|
| 8 |
+
# Core AI/ML
|
| 9 |
+
openai>=1.3.0
|
| 10 |
+
|
| 11 |
+
# Data Processing
|
| 12 |
pandas>=2.0.0
|
| 13 |
numpy>=1.24.0
|
| 14 |
|
|
|
|
| 20 |
requests>=2.31.0
|
| 21 |
duckduckgo-search>=4.0.0
|
| 22 |
|
| 23 |
+
# Configuration
|
| 24 |
python-dotenv>=1.0.0
|
| 25 |
|
| 26 |
# Authentication & Security
|
| 27 |
bcrypt>=4.0.0
|
|
|
|
| 28 |
|
| 29 |
+
# Logging
|
| 30 |
structlog>=23.0.0
|
| 31 |
|
| 32 |
# Template Processing
|
| 33 |
jinja2
|
| 34 |
|
| 35 |
+
# System utilities
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
psutil>=5.9.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
test_basic.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""
|
| 3 |
+
Basic test to check if the app can initialize
|
| 4 |
+
"""
|
| 5 |
+
|
| 6 |
+
import gradio as gr
|
| 7 |
+
|
| 8 |
+
def create_simple_app():
|
| 9 |
+
"""Create a minimal app to test basic functionality"""
|
| 10 |
+
with gr.Blocks(title="Test App") as app:
|
| 11 |
+
gr.Markdown("# 🧪 Basic Test App")
|
| 12 |
+
gr.Markdown("If you can see this, the basic setup works!")
|
| 13 |
+
|
| 14 |
+
test_input = gr.Textbox(label="Test Input", placeholder="Type something...")
|
| 15 |
+
test_output = gr.Textbox(label="Test Output")
|
| 16 |
+
test_button = gr.Button("Test Button")
|
| 17 |
+
|
| 18 |
+
def test_function(text):
|
| 19 |
+
return f"Echo: {text}"
|
| 20 |
+
|
| 21 |
+
test_button.click(test_function, inputs=[test_input], outputs=[test_output])
|
| 22 |
+
|
| 23 |
+
return app
|
| 24 |
+
|
| 25 |
+
if __name__ == "__main__":
|
| 26 |
+
print("🧪 Creating basic test app...")
|
| 27 |
+
app = create_simple_app()
|
| 28 |
+
print("✅ App created successfully")
|
| 29 |
+
|
| 30 |
+
# Test with authentication
|
| 31 |
+
auth_credentials = [("test", "test123")]
|
| 32 |
+
|
| 33 |
+
print("🚀 Launching with authentication...")
|
| 34 |
+
app.launch(
|
| 35 |
+
auth=auth_credentials,
|
| 36 |
+
auth_message="Test login: username 'test', password 'test123'",
|
| 37 |
+
server_name="0.0.0.0",
|
| 38 |
+
server_port=7860,
|
| 39 |
+
share=False
|
| 40 |
+
)
|