Skip to content

Commit 74ac517

Browse files
authored
Merge pull request #14 from cindytsai/deploy
Deploy
2 parents 958e696 + a614020 commit 74ac517

6 files changed

Lines changed: 18 additions & 16 deletions

File tree

backend/app/main.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from flask import Flask, jsonify, request
22
from flask_cors import CORS
3-
from app.services.topic_service import TopicService
4-
from app.services.ai_service import AITopicProcessor
3+
from services.topic_service import TopicService
4+
from services.ai_service import AITopicProcessor
55

66
app = Flask(__name__)
77
CORS(app, resources={
@@ -15,7 +15,7 @@
1515
topic_service = TopicService()
1616
ai_processor = AITopicProcessor()
1717

18-
@app.route('/process-topics', methods=['GET', 'POST'])
18+
@app.route('/api/process-topics', methods=['GET', 'POST'])
1919
def process_topics():
2020
try:
2121
if request.method == 'POST':
@@ -33,7 +33,7 @@ def process_topics():
3333
"message": "An error occurred while processing the request"
3434
}), 500
3535

36-
@app.route('/ai-process', methods=['GET', 'POST'])
36+
@app.route('/api/ai-process', methods=['GET', 'POST'])
3737
def ai_process():
3838
try:
3939
if request.method == 'POST':
@@ -77,4 +77,4 @@ def home():
7777
print("Starting Flask server...")
7878
port = 5002
7979
print(f"Server running on: http://127.0.0.1:{port}")
80-
app.run(host='127.0.0.1', port=port, debug=True)
80+
app.run(host='127.0.0.1', port=port, debug=True)

backend/app/services/topic_service.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from collections import Counter
22
import duckdb
3-
from app.utils.cache import get_cached_topics, save_cached_topics
3+
from utils.cache import get_cached_topics, save_cached_topics
44
import os
55

66
class TopicService:
@@ -13,7 +13,7 @@ class TopicService:
1313
}
1414

1515
def __init__(self):
16-
db_path = '../public/data/github_meta.duckdb'
16+
db_path = '/home/user/projects/deepgit/public/data/github_meta.duckdb'
1717

1818
# Check if database exists
1919
if os.path.exists(db_path):
@@ -82,4 +82,4 @@ def process_topics(self, search_term: str):
8282
"success": False,
8383
"error": str(e),
8484
"message": "An error occurred while processing the request"
85-
}
85+
}

backend/app/utils/cache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
import json
33

44
def get_cached_topics(search_term):
5-
cache_file = Path('../public/data/cached_topics') / f"{search_term}.json"
5+
cache_file = Path('../../public/data/cached_topics') / f"{search_term}.json"
66
if cache_file.exists():
77
with open(cache_file, 'r') as f:
88
return json.load(f)
99
return None
1010

1111
def save_cached_topics(search_term, topics_data):
12-
cache_dir = Path('../public/data/cached_topics')
12+
cache_dir = Path('../../public/data/cached_topics')
1313
cache_dir.mkdir(exist_ok=True)
1414
cache_file = cache_dir / f"{search_term}.json"
1515
with open(cache_file, 'w') as f:
16-
json.dump(topics_data, f)
16+
json.dump(topics_data, f)

backend/requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@ google-generativeai
55
openai
66
fastapi
77
uvicorn
8-
kaggle>=1.5.16
8+
kaggle>=1.5.16
9+
numpy
10+
pandas

src/components/TopicRefiner.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export const TopicRefiner: FC<TopicRefinerProps> = ({
8484
}
8585

8686
try {
87-
const response = await fetch('http://127.0.0.1:5002/ai-process', {
87+
const response = await fetch('/api/ai-process', {
8888
method: 'POST',
8989
headers: {
9090
'Content-Type': 'application/json',
@@ -369,4 +369,4 @@ export const TopicRefiner: FC<TopicRefinerProps> = ({
369369
)}
370370
</>
371371
);
372-
};
372+
};

src/views/TopicHistogram.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ const TopicHistogram: FC = () => {
173173

174174
setIsLoading(true);
175175

176-
fetch('http://127.0.0.1:5002/process-topics', {
176+
fetch('/api/process-topics', {
177177
method: 'POST',
178178
headers: {
179179
'Content-Type': 'application/json',
@@ -427,4 +427,4 @@ const TopicHistogram: FC = () => {
427427
);
428428
};
429429

430-
export default TopicHistogram;
430+
export default TopicHistogram;

0 commit comments

Comments
 (0)