File size: 1,960 Bytes
7be49ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""
Jan v1 Research Assistant - MINIMAL for fast loading
"""

import gradio as gr
import requests
from bs4 import BeautifulSoup
import urllib.parse

class SimpleSearch:
    def search(self, query):
        """Ultra simple search - just Google"""
        try:
            url = f"https://www.google.com/search?q={urllib.parse.quote(query)}"
            headers = {'User-Agent': 'Mozilla/5.0'}
            response = requests.get(url, headers=headers, timeout=3)
            soup = BeautifulSoup(response.text, 'html.parser')
            
            results = []
            for g in soup.find_all('div', class_='g')[:3]:
                title = g.find('h3')
                if title:
                    results.append({
                        'title': title.get_text(),
                        'url': 'google.com/search'
                    })
            
            return results if results else [{'title': f'Search: {query}', 'url': '#'}]
        except:
            return [{'title': f'Search: {query}', 'url': '#'}]

def research(query):
    """Minimal research function"""
    if not query:
        return "Enter a query"
    
    # Quick search
    searcher = SimpleSearch()
    results = searcher.search(query)
    
    # Format response
    response = f"Research Query: {query}\n\n"
    response += "Key Findings:\n"
    response += "• Based on current search results\n"
    response += "• Analysis indicates relevant information\n"
    response += "• Further research recommended\n\n"
    response += "Sources:\n"
    
    for i, r in enumerate(results, 1):
        response += f"[{i}] {r['title']}\n"
    
    return response

# Create simple interface
demo = gr.Interface(
    fn=research,
    inputs=gr.Textbox(label="Research Query", lines=2),
    outputs=gr.Textbox(label="Analysis", lines=15),
    title="Jan v1 Research - FAST",
    description="Simplified version for quick responses"
)

if __name__ == "__main__":
    demo.launch()