File size: 1,132 Bytes
eec008c
 
c979284
 
 
 
eec008c
 
 
 
 
c979284
eec008c
 
c979284
eec008c
 
c979284
eec008c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from whale_core import parser, agents
import gradio as gr

print("πŸ‹ Welcome to HuggingWhale.AI")
print("Drop your chaos here and we'll pretend to make sense of it...\n")

def process_file(uploaded_file):
    try:
        # Parse and embed the file
        doc = parser.parse_file(uploaded_file.name)
        chunks = parser.chunk_and_embed(doc)

        # Load agent configs
        agent_cfgs = agents.load_agents("agents/config.yaml")

        # Run simulated agent conversations
        responses = agents.run_agents_on_text(agent_cfgs, doc)

        # Format response output
        output = ""
        for name, reply in responses.items():
            output += f"\nπŸ€– {name} says:\n{reply}\n"

        return output.strip()

    except Exception as e:
        return f"πŸ’₯ Oops! Something went wrong:\n{str(e)}"

# Launch Gradio GUI
gr.Interface(
    fn=process_file,
    inputs=gr.File(label="πŸ“„ Upload your PDF or Text file"),
    outputs=gr.Textbox(label="🧠 Agent Responses", lines=20),
    title="HuggingWhale.AI",
    description="Drop a chaotic file. Let our agents attempt to decode the madness."
).launch()