Spaces:
Runtime error
Runtime error
File size: 1,424 Bytes
aa9134d | 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 35 36 37 38 39 40 41 42 43 44 45 46 | #!/usr/bin/env python3
"""
Test script to verify the Gradio interface works correctly
"""
import asyncio
from research_manager import ResearchManager
async def test_research_flow():
"""Test the research flow without Gradio to ensure it works"""
manager = ResearchManager()
# Test query
query = "The impact of AI on healthcare"
print("Testing research flow...")
print(f"Query: {query}")
print("-" * 50)
# First run - should return questions
print("Step 1: Getting questions...")
async for chunk in manager.run(query):
if isinstance(chunk, dict) and chunk.get("type") == "questions":
print(f"Generated {len(chunk['questions'])} questions:")
for q in chunk['questions']:
print(f" {q.number}. {q.question}")
break
else:
print(f"Status: {chunk}")
print("\n" + "-" * 50)
# Simulate user answers
sample_answers = {
"1": "I'm interested in diagnostic accuracy improvements",
"2": "Looking at the last 5 years of developments",
"3": "Focus on both benefits and challenges"
}
print("Step 2: Running research with sample answers...")
async for chunk in manager.run(query, sample_answers):
print(f"Status: {chunk}")
if __name__ == "__main__":
asyncio.run(test_research_flow())
|