Yoon-gu Hwang Claude commited on
Commit
0ffbf55
·
1 Parent(s): 3b42a60

불필요한 파일 정리

Browse files

- basic_chatbot/tab.py 삭제 (app.py에서 직접 함수 정의)
- ml_pipeline/tab.py 삭제 (app.py에서 직접 함수 정의)
- requirements.txt 삭제 (pyproject.toml과 uv.lock으로 관리)
- __pycache__ 디렉토리들 정리

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (3) hide show
  1. basic_chatbot/tab.py +0 -85
  2. ml_pipeline/tab.py +0 -91
  3. requirements.txt +0 -5
basic_chatbot/tab.py DELETED
@@ -1,85 +0,0 @@
1
- import gradio as gr
2
- from gradio import ChatMessage
3
- from langchain_core.messages import BaseMessage, HumanMessage
4
- from .workflow import app as workflow
5
-
6
-
7
- def format_namespace(namespace):
8
- return namespace[-1].split(":")[0] if len(namespace) > 0 else "root graph"
9
-
10
-
11
- def generate_response(message, history):
12
- inputs = {
13
- "messages": [HumanMessage(content=message)],
14
- }
15
- node_names = []
16
- response = []
17
- for namespace, chunk in workflow.stream(
18
- inputs,
19
- stream_mode="updates", subgraphs=True
20
- ):
21
- for node_name, node_chunk in chunk.items():
22
- if len(node_names) > 0 and node_name not in node_names:
23
- continue
24
-
25
- if len(response) > 0:
26
- response[-1].metadata["status"] = "done"
27
- msg = []
28
- formatted_namespace = format_namespace(namespace)
29
- if formatted_namespace == "root graph":
30
- print(f"🔄 Node: \033[1;36m{node_name}\033[0m 🔄")
31
- meta_title = f"🤔 `{node_name}`"
32
- else:
33
- print(
34
- f"🔄 Node: \033[1;36m{node_name}\033[0m in [\033[1;33m{formatted_namespace}\033[0m] 🔄"
35
- )
36
- meta_title = f"🤔 `{node_name}` in `{formatted_namespace}`"
37
-
38
- response.append(ChatMessage(content="", metadata={"title": meta_title, "status": "pending"}))
39
- yield response
40
- print("- " * 25)
41
-
42
- out_str = []
43
- if isinstance(node_chunk, dict):
44
- for k, v in node_chunk.items():
45
- if isinstance(v, BaseMessage):
46
- v.pretty_print()
47
- out_str.append(v.pretty_repr())
48
- elif isinstance(v, list):
49
- for list_item in v:
50
- if isinstance(list_item, BaseMessage):
51
- list_item.pretty_print()
52
- out_str.append(list_item.pretty_repr())
53
- else:
54
- out_str.append(list_item)
55
- print(list_item)
56
- elif isinstance(v, dict):
57
- for node_chunk_key, node_chunk_value in node_chunk.items():
58
- out_str.append(f"{node_chunk_key}:\n{node_chunk_value}")
59
- print(f"{node_chunk_key}:\n{node_chunk_value}")
60
- else:
61
- out_str.append(f"{k}:\n{v}")
62
- print(f"\033[1;32m{k}\033[0m:\n{v}")
63
- response[-1].content = "\n".join(out_str)
64
- yield response
65
- else:
66
- if node_chunk is not None:
67
- for item in node_chunk:
68
- out_str.append(item)
69
- print(item)
70
- response[-1].content = "\n".join(out_str)
71
- yield response
72
- yield response
73
- print("=" * 50)
74
- response[-1].metadata["status"] = "done"
75
- response.append(ChatMessage(content=node_chunk['messages'][-1].content))
76
- yield response
77
-
78
-
79
- demo = gr.ChatInterface(
80
- generate_response,
81
- type="messages",
82
- title="Basic Multi-Agent Chatbot",
83
- examples=["2024년의 the FAANG companies 총 근로자규모에 대한 분석을 한국어로 부탁해!"],
84
- cache_examples=False
85
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
ml_pipeline/tab.py DELETED
@@ -1,91 +0,0 @@
1
- import gradio as gr
2
- from gradio import ChatMessage
3
- from langchain_core.messages import BaseMessage, HumanMessage
4
- from .workflow import ml_app as workflow
5
-
6
-
7
- def format_namespace(namespace):
8
- return namespace[-1].split(":")[0] if len(namespace) > 0 else "root graph"
9
-
10
-
11
- def generate_response(message, history):
12
- inputs = {
13
- "messages": [HumanMessage(content=message)],
14
- }
15
- node_names = []
16
- response = []
17
- for namespace, chunk in workflow.stream(
18
- inputs,
19
- stream_mode="updates", subgraphs=True
20
- ):
21
- for node_name, node_chunk in chunk.items():
22
- if len(node_names) > 0 and node_name not in node_names:
23
- continue
24
-
25
- if len(response) > 0:
26
- response[-1].metadata["status"] = "done"
27
- msg = []
28
- formatted_namespace = format_namespace(namespace)
29
- if formatted_namespace == "root graph":
30
- print(f"🔄 Node: \033[1;36m{node_name}\033[0m 🔄")
31
- meta_title = f"🤔 `{node_name}`"
32
- else:
33
- print(
34
- f"🔄 Node: \033[1;36m{node_name}\033[0m in [\033[1;33m{formatted_namespace}\033[0m] 🔄"
35
- )
36
- meta_title = f"🤔 `{node_name}` in `{formatted_namespace}`"
37
-
38
- response.append(ChatMessage(content="", metadata={"title": meta_title, "status": "pending"}))
39
- yield response
40
- print("- " * 25)
41
-
42
- out_str = []
43
- if isinstance(node_chunk, dict):
44
- for k, v in node_chunk.items():
45
- if isinstance(v, BaseMessage):
46
- v.pretty_print()
47
- out_str.append(v.pretty_repr())
48
- elif isinstance(v, list):
49
- for list_item in v:
50
- if isinstance(list_item, BaseMessage):
51
- list_item.pretty_print()
52
- out_str.append(list_item.pretty_repr())
53
- else:
54
- out_str.append(list_item)
55
- print(list_item)
56
- elif isinstance(v, dict):
57
- for node_chunk_key, node_chunk_value in node_chunk.items():
58
- out_str.append(f"{node_chunk_key}:\n{node_chunk_value}")
59
- print(f"{node_chunk_key}:\n{node_chunk_value}")
60
- else:
61
- out_str.append(f"{k}:\n{v}")
62
- print(f"\033[1;32m{k}\033[0m:\n{v}")
63
- response[-1].content = "\n".join(out_str)
64
- yield response
65
- else:
66
- if node_chunk is not None:
67
- for item in node_chunk:
68
- out_str.append(item)
69
- print(item)
70
- response[-1].content = "\n".join(out_str)
71
- yield response
72
- yield response
73
- print("=" * 50)
74
- response[-1].metadata["status"] = "done"
75
- response.append(ChatMessage(content=node_chunk['messages'][-1].content))
76
- yield response
77
-
78
-
79
- demo = gr.ChatInterface(
80
- generate_response,
81
- type="messages",
82
- title="ML Pipeline Automation System",
83
- examples=[
84
- "user_events 테이블에서 2024-01-01부터 2024-12-31까지 이벤트 데이터를 추출하고, 모델을 사전학습한 후 5개 클래스 분류 모델을 학습하고 평가해줘",
85
- "customer_logs 테이블에서 2024년 1분기 데이터를 추출하고, GPT2 모델로 사전학습 후 감성분석용 3클래스 분류 모델 만들어줘",
86
- "transaction_data 테이블에서 최근 6개월 데이터로 이상거래 탐지 모델 학습하고 성능 평가 부탁해",
87
- "product_reviews 테이블에서 2024년 전체 리뷰 데이터를 추출해서 별점 예측 모델을 만들고 F1 score 확인해줘",
88
- "서버 로그 데이터에서 에러 패턴을 학습할 수 있는 분류 모델을 처음부터 끝까지 만들어줘"
89
- ],
90
- cache_examples=False
91
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
requirements.txt DELETED
@@ -1,5 +0,0 @@
1
- langgraph==0.5.4
2
- langchain==0.3.27
3
- langchain-openai==0.3.28
4
- langchain-teddynote==0.3.45
5
- langgraph-supervisor==0.0.28