aymnsk commited on
Commit
5e2c798
Β·
verified Β·
1 Parent(s): cb3bc65

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -15
app.py CHANGED
@@ -1,6 +1,5 @@
1
  # app.py
2
 
3
- from fastapi import FastAPI
4
  import gradio as gr
5
  from multi_inference import multi_query as deepseek_query
6
 
@@ -9,16 +8,11 @@ from agents.historian import HistorianAgent
9
  from agents.hacker import HackerAgent
10
  from agents.comedian import ComedianAgent
11
 
12
- # Initialize agents
13
  philosopher = PhilosopherAgent()
14
  historian = HistorianAgent()
15
  hacker = HackerAgent()
16
  comedian = ComedianAgent()
17
 
18
- # Initialize FastAPI
19
- app = FastAPI()
20
-
21
- # Chat logic
22
  def chat(prompt):
23
  responses = {}
24
  responses["πŸ§™β€β™‚οΈ Philosopher"] = philosopher.run(prompt, deepseek_query)
@@ -27,18 +21,12 @@ def chat(prompt):
27
  responses["🎭 Comedian"] = comedian.run(prompt, deepseek_query)
28
  return responses
29
 
30
- # Gradio Interface
31
- gradio_app = gr.Interface(
32
  fn=chat,
33
  inputs=gr.Textbox(label="Ask a Question"),
34
  outputs=gr.JSON(label="Responses from Agents"),
35
  title="Multi-Agent AI Chatroom πŸ€–",
36
  )
37
 
38
- # Mount Gradio to FastAPI
39
- app = gr.mount_gradio_app(app, gradio_app, path="/")
40
-
41
- # Optional FastAPI root endpoint
42
- @app.get("/status")
43
- def read_status():
44
- return {"status": "running"}
 
1
  # app.py
2
 
 
3
  import gradio as gr
4
  from multi_inference import multi_query as deepseek_query
5
 
 
8
  from agents.hacker import HackerAgent
9
  from agents.comedian import ComedianAgent
10
 
 
11
  philosopher = PhilosopherAgent()
12
  historian = HistorianAgent()
13
  hacker = HackerAgent()
14
  comedian = ComedianAgent()
15
 
 
 
 
 
16
  def chat(prompt):
17
  responses = {}
18
  responses["πŸ§™β€β™‚οΈ Philosopher"] = philosopher.run(prompt, deepseek_query)
 
21
  responses["🎭 Comedian"] = comedian.run(prompt, deepseek_query)
22
  return responses
23
 
24
+ demo = gr.Interface(
 
25
  fn=chat,
26
  inputs=gr.Textbox(label="Ask a Question"),
27
  outputs=gr.JSON(label="Responses from Agents"),
28
  title="Multi-Agent AI Chatroom πŸ€–",
29
  )
30
 
31
+ if __name__ == "__main__":
32
+ demo.launch()