Spaces:
Sleeping
Sleeping
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()
|