Yuchan5386 commited on
Commit
172af21
ยท
verified ยท
1 Parent(s): c689606

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -1
app.py CHANGED
@@ -3,7 +3,21 @@ import gradio as gr
3
  from sklearn.feature_extraction.text import TfidfVectorizer
4
  from sklearn.metrics.pairwise import cosine_similarity
5
 
6
- file_path = "InstructData.jsonl"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
 
8
  # 1. ๋Œ€ํ™” ๋ฐ์ดํ„ฐ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ (๋ชจ๋“  human-gpt ์Œ ์ถ”์ถœ)
9
  def load_conversations(file_path):
 
3
  from sklearn.feature_extraction.text import TfidfVectorizer
4
  from sklearn.metrics.pairwise import cosine_similarity
5
 
6
+ import requests
7
+
8
+ def download_file(url, save_path):
9
+ response = requests.get(url, stream=True) # ์ŠคํŠธ๋ฆฌ๋ฐ ๋ชจ๋“œ๋กœ ๋ฐ›์•„์„œ ๋ฉ”๋ชจ๋ฆฌ ์ ˆ์•ฝ
10
+ response.raise_for_status() # ์˜ค๋ฅ˜ ์žˆ์œผ๋ฉด ์˜ˆ์™ธ ๋ฐœ์ƒ
11
+
12
+ with open(save_path, 'wb') as f:
13
+ for chunk in response.iter_content(chunk_size=8192):
14
+ if chunk:
15
+ f.write(chunk)
16
+ print(f"ํŒŒ์ผ์ด {save_path}์— ์ €์žฅ๋˜์—ˆ์–ด์š”!")
17
+
18
+ # ์‚ฌ์šฉ ์˜ˆ์‹œ
19
+ download_file('', 'data.jsonl')
20
+ file_path = 'data.jsonl'
21
 
22
  # 1. ๋Œ€ํ™” ๋ฐ์ดํ„ฐ ๋ถˆ๋Ÿฌ์˜ค๊ธฐ (๋ชจ๋“  human-gpt ์Œ ์ถ”์ถœ)
23
  def load_conversations(file_path):