Schmitz005 commited on
Commit
134a706
Β·
verified Β·
1 Parent(s): c3623f8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -24
app.py CHANGED
@@ -1,36 +1,24 @@
 
1
  from whale_core import parser, agents
2
- import gradio as gr
3
 
4
- print("πŸ‹ Welcome to HuggingWhale.AI")
5
- print("Drop your chaos here and we'll pretend to make sense of it...\n")
6
 
7
- def process_file(uploaded_file):
 
 
 
 
 
8
  try:
9
- # Parse and embed the file
10
  doc = parser.parse_file(uploaded_file.name)
11
  chunks = parser.chunk_and_embed(doc)
12
 
13
- # Load agent configs
14
- agent_cfgs = agents.load_agents("agents/config.yaml")
15
-
16
- # Run simulated agent conversations
17
  responses = agents.run_agents_on_text(agent_cfgs, doc)
18
 
19
- # Format response output
20
- output = ""
21
  for name, reply in responses.items():
22
- output += f"\nπŸ€– {name} says:\n{reply}\n"
23
-
24
- return output.strip()
25
 
26
  except Exception as e:
27
- return f"πŸ’₯ Oops! Something went wrong:\n{str(e)}"
28
-
29
- # Launch Gradio GUI
30
- gr.Interface(
31
- fn=process_file,
32
- inputs=gr.File(label="πŸ“„ Upload your PDF or Text file"),
33
- outputs=gr.Textbox(label="🧠 Agent Responses", lines=20),
34
- title="HuggingWhale.AI",
35
- description="Drop a chaotic file. Let our agents attempt to decode the madness."
36
- ).launch()
 
1
+ import streamlit as st
2
  from whale_core import parser, agents
 
3
 
4
+ st.set_page_config(page_title="HuggingWhale.AI", page_icon="πŸ‹")
 
5
 
6
+ st.title("πŸ‹ HuggingWhale.AI")
7
+ st.write("Drop your chaos here and we'll pretend to make sense of it...")
8
+
9
+ uploaded_file = st.file_uploader("πŸ“„ Upload your PDF or Text file", type=["pdf", "txt"])
10
+
11
+ if uploaded_file:
12
  try:
 
13
  doc = parser.parse_file(uploaded_file.name)
14
  chunks = parser.chunk_and_embed(doc)
15
 
16
+ agent_cfgs = agents.load_agents("config.yaml")
 
 
 
17
  responses = agents.run_agents_on_text(agent_cfgs, doc)
18
 
19
+ st.subheader("🧠 Agent Responses")
 
20
  for name, reply in responses.items():
21
+ st.markdown(f"**πŸ€– {name} says:**\n\n{reply}")
 
 
22
 
23
  except Exception as e:
24
+ st.error(f"πŸ’₯ Oops! Something went wrong:\n{str(e)}")