Spaces:
openfree
/
Running on CPU Upgrade

seawolf2357 commited on
Commit
0e37fb4
ยท
verified ยท
1 Parent(s): c7302ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -22,7 +22,7 @@ MAJOR_COUNTRIES = [
22
  "Indonesia", "Philippines", "Vietnam", "Pakistan", "Bangladesh"
23
  ]
24
 
25
- def search_serphouse(query, country, page=1, num_result=10):
26
  url = "https://api.serphouse.com/serp/live"
27
 
28
  now = datetime.utcnow()
@@ -113,7 +113,7 @@ def format_results_from_raw(results):
113
 
114
  def serphouse_search(query, country):
115
  page = 1
116
- num_result = 10
117
  results = search_serphouse(query, country, page, num_result)
118
  error_message, articles = format_results_from_raw(results)
119
  return error_message, articles
@@ -137,7 +137,7 @@ footer {
137
 
138
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
139
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, title="NewsAI ์„œ๋น„์Šค") as iface:
140
- gr.Markdown("๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์›ํ•˜๋Š” ๊ตญ๊ฐ€๋ฅผ ์„ ํƒํ•˜๋ฉด, ๊ฒ€์ƒ‰์–ด์™€ ์ผ์น˜ํ•˜๋Š” 24์‹œ๊ฐ„ ์ด๋‚ด ๋‰ด์Šค๋ฅผ ์ตœ๋Œ€ 10๊ฐœ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.")
141
 
142
  with gr.Column():
143
  with gr.Row():
@@ -151,9 +151,9 @@ with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, title="NewsAI ์„œ๋น„์Šค") as
151
  # ๊ธฐ์‚ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ์ƒํƒœ ๋ณ€์ˆ˜
152
  articles_state = gr.State([]) # ์ดˆ๊ธฐ๊ฐ’์„ ๋นˆ ๋ฆฌ์ŠคํŠธ๋กœ ์„ค์ •
153
 
154
- # ์ตœ๋Œ€ 10๊ฐœ์˜ ๊ธฐ์‚ฌ์— ๋Œ€ํ•œ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฏธ๋ฆฌ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
155
  article_components = []
156
- for i in range(10):
157
  with gr.Group(visible=False) as article_group:
158
  title = gr.Markdown()
159
  image = gr.Image(width=200, height=150)
 
22
  "Indonesia", "Philippines", "Vietnam", "Pakistan", "Bangladesh"
23
  ]
24
 
25
+ def search_serphouse(query, country, page=1, num_result=100): # num_result๋ฅผ 100์œผ๋กœ ๋ณ€๊ฒฝ
26
  url = "https://api.serphouse.com/serp/live"
27
 
28
  now = datetime.utcnow()
 
113
 
114
  def serphouse_search(query, country):
115
  page = 1
116
+ num_result = 100 # num_result๋ฅผ 100์œผ๋กœ ์„ค์ •
117
  results = search_serphouse(query, country, page, num_result)
118
  error_message, articles = format_results_from_raw(results)
119
  return error_message, articles
 
137
 
138
  # Gradio ์ธํ„ฐํŽ˜์ด์Šค ๊ตฌ์„ฑ
139
  with gr.Blocks(theme="Nymbo/Nymbo_Theme", css=css, title="NewsAI ์„œ๋น„์Šค") as iface:
140
+ gr.Markdown("๊ฒ€์ƒ‰์–ด๋ฅผ ์ž…๋ ฅํ•˜๊ณ  ์›ํ•˜๋Š” ๊ตญ๊ฐ€๋ฅผ ์„ ํƒํ•˜๋ฉด, ๊ฒ€์ƒ‰์–ด์™€ ์ผ์น˜ํ•˜๋Š” 24์‹œ๊ฐ„ ์ด๋‚ด ๋‰ด์Šค๋ฅผ ์ตœ๋Œ€ 100๊ฐœ ์ถœ๋ ฅํ•ฉ๋‹ˆ๋‹ค.")
141
 
142
  with gr.Column():
143
  with gr.Row():
 
151
  # ๊ธฐ์‚ฌ ๋ฐ์ดํ„ฐ๋ฅผ ์ €์žฅํ•  ์ƒํƒœ ๋ณ€์ˆ˜
152
  articles_state = gr.State([]) # ์ดˆ๊ธฐ๊ฐ’์„ ๋นˆ ๋ฆฌ์ŠคํŠธ๋กœ ์„ค์ •
153
 
154
+ # ์ตœ๋Œ€ 100๊ฐœ์˜ ๊ธฐ์‚ฌ์— ๋Œ€ํ•œ ์ปดํฌ๋„ŒํŠธ๋ฅผ ๋ฏธ๋ฆฌ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
155
  article_components = []
156
+ for i in range(100): # 100๊ฐœ์˜ ์ปดํฌ๋„ŒํŠธ ์ƒ์„ฑ
157
  with gr.Group(visible=False) as article_group:
158
  title = gr.Markdown()
159
  image = gr.Image(width=200, height=150)