Spaces:
openfree
/
Running on CPU Upgrade

seawolf2357 commited on
Commit
34db24b
·
verified ·
1 Parent(s): 6097fb2

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -11
app.py CHANGED
@@ -3,12 +3,18 @@ import requests
3
 
4
  API_KEY = "V38CNn4HXpLtynJQyOeoUensTEYoFy8PBUxKpDqAW1pawT1vfJ2BWtPQ98h6"
5
 
6
- # List of English-speaking countries supported by SERPHouse API
7
- ENGLISH_SPEAKING_COUNTRIES = [
8
- "United States", "United Kingdom", "Canada", "Australia", "New Zealand",
9
- "Ireland", "South Africa", "Jamaica", "Trinidad and Tobago", "Guyana",
10
- "Belize", "Barbados", "Bahamas", "Antigua and Barbuda", "Saint Kitts and Nevis",
11
- "Dominica", "Saint Lucia", "Saint Vincent and the Grenadines", "Grenada"
 
 
 
 
 
 
12
  ]
13
 
14
  def search_serphouse(query, domain, language, device, serp_type, location, country, verbatim, gfilter, page, num_result):
@@ -21,7 +27,7 @@ def search_serphouse(query, domain, language, device, serp_type, location, count
21
  "device": device,
22
  "serp_type": serp_type,
23
  "loc": location,
24
- "country": country, # Added country parameter
25
  "verbatim": verbatim,
26
  "gfilter": gfilter,
27
  "page": page,
@@ -52,6 +58,9 @@ def format_results(results):
52
  return str(results)
53
 
54
  def serphouse_search(query, domain, language, device, serp_type, location, country, verbatim, gfilter, page, num_result):
 
 
 
55
  results = search_serphouse(query, domain, language, device, serp_type, location, country, verbatim, gfilter, page, num_result)
56
  return format_results(results)
57
 
@@ -59,12 +68,12 @@ iface = gr.Interface(
59
  fn=serphouse_search,
60
  inputs=[
61
  gr.Textbox(label="Search Query"),
62
- gr.Dropdown(["google.com", "google.co.uk", "google.ca", "google.com.au"], label="Domain"),
63
- gr.Dropdown(["en"], label="Language"),
64
  gr.Radio(["desktop", "mobile"], label="Device"),
65
  gr.Dropdown(["web", "news", "images"], label="SERP Type"),
66
  gr.Textbox(label="Location"),
67
- gr.Dropdown(ENGLISH_SPEAKING_COUNTRIES, label="Country"), # Added country dropdown
68
  gr.Checkbox(label="Verbatim"),
69
  gr.Checkbox(label="Google Filter"),
70
  gr.Slider(1, 10, 1, label="Page"),
@@ -72,7 +81,7 @@ iface = gr.Interface(
72
  ],
73
  outputs="text",
74
  title="SERPHouse Search Interface",
75
- description="Enter your search parameters to get results from the SERPHouse API. You can now select an English-speaking country."
76
  )
77
 
78
  iface.launch()
 
3
 
4
  API_KEY = "V38CNn4HXpLtynJQyOeoUensTEYoFy8PBUxKpDqAW1pawT1vfJ2BWtPQ98h6"
5
 
6
+ # 주요 50개 국가 목록 (영어 표기)
7
+ MAJOR_COUNTRIES = [
8
+ "United States", "United Kingdom", "Canada", "Australia", "Germany",
9
+ "France", "Japan", "South Korea", "China", "India",
10
+ "Brazil", "Mexico", "Russia", "Italy", "Spain",
11
+ "Netherlands", "Sweden", "Switzerland", "Norway", "Denmark",
12
+ "Finland", "Belgium", "Austria", "New Zealand", "Ireland",
13
+ "Singapore", "Hong Kong", "Israel", "United Arab Emirates", "Saudi Arabia",
14
+ "South Africa", "Turkey", "Egypt", "Poland", "Czech Republic",
15
+ "Hungary", "Greece", "Portugal", "Argentina", "Chile",
16
+ "Colombia", "Peru", "Venezuela", "Thailand", "Malaysia",
17
+ "Indonesia", "Philippines", "Vietnam", "Pakistan", "Bangladesh"
18
  ]
19
 
20
  def search_serphouse(query, domain, language, device, serp_type, location, country, verbatim, gfilter, page, num_result):
 
27
  "device": device,
28
  "serp_type": serp_type,
29
  "loc": location,
30
+ "country": country,
31
  "verbatim": verbatim,
32
  "gfilter": gfilter,
33
  "page": page,
 
58
  return str(results)
59
 
60
  def serphouse_search(query, domain, language, device, serp_type, location, country, verbatim, gfilter, page, num_result):
61
+ verbatim = "1" if verbatim else "0"
62
+ gfilter = "1" if gfilter else "0"
63
+
64
  results = search_serphouse(query, domain, language, device, serp_type, location, country, verbatim, gfilter, page, num_result)
65
  return format_results(results)
66
 
 
68
  fn=serphouse_search,
69
  inputs=[
70
  gr.Textbox(label="Search Query"),
71
+ gr.Dropdown(["google.com", "google.co.uk", "google.ca", "google.com.au", "google.de", "google.fr", "google.co.jp", "google.co.kr", "google.com.br", "google.com.mx"], label="Domain"),
72
+ gr.Dropdown(["en", "de", "fr", "es", "it", "pt", "ru", "ja", "ko", "zh-CN"], label="Language"),
73
  gr.Radio(["desktop", "mobile"], label="Device"),
74
  gr.Dropdown(["web", "news", "images"], label="SERP Type"),
75
  gr.Textbox(label="Location"),
76
+ gr.Dropdown(MAJOR_COUNTRIES, label="Country"),
77
  gr.Checkbox(label="Verbatim"),
78
  gr.Checkbox(label="Google Filter"),
79
  gr.Slider(1, 10, 1, label="Page"),
 
81
  ],
82
  outputs="text",
83
  title="SERPHouse Search Interface",
84
+ description="Enter your search parameters to get results from the SERPHouse API. You can now select from 50 major countries."
85
  )
86
 
87
  iface.launch()