svhozt commited on
Commit
23457e3
·
1 Parent(s): 436193e

Fix urllib

Browse files
Files changed (1) hide show
  1. gps.py +35 -10
gps.py CHANGED
@@ -6,6 +6,10 @@ import gradio as gr
6
  USER_ID = "94777895019" # Your phone number in international format
7
  PASSWORD = "9624" # Your 4-digit password
8
 
 
 
 
 
9
  # List of 20 phone numbers (SIMs) installed in GPS trackers
10
  SIM_NUMBERS = [
11
  "94757271180", "94758339857", "94758529725", "94753670267", "94758620601",
@@ -98,15 +102,36 @@ def start_imei_processing():
98
  logs = process_imei_batches()
99
  return "\n".join(logs)
100
 
101
-
102
- # Gradio interface
103
- iface = gr.Interface(
104
- fn=start_imei_processing,
105
- inputs=[],
106
- outputs="text",
107
- title="GPS Tracker IMEI Writer",
108
- description="Click the button below to start processing IMEI numbers.",
109
- live=True
110
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
  iface.launch(share=True)
 
6
  USER_ID = "94777895019" # Your phone number in international format
7
  PASSWORD = "9624" # Your 4-digit password
8
 
9
+ # Admin credentials for the login page (you can change them)
10
+ ADMIN_USERNAME = "admin"
11
+ ADMIN_PASSWORD = "1234"
12
+
13
  # List of 20 phone numbers (SIMs) installed in GPS trackers
14
  SIM_NUMBERS = [
15
  "94757271180", "94758339857", "94758529725", "94753670267", "94758620601",
 
102
  logs = process_imei_batches()
103
  return "\n".join(logs)
104
 
105
+ # Login function
106
+ def login(username, password):
107
+ if username == ADMIN_USERNAME and password == ADMIN_PASSWORD:
108
+ return gr.update(visible=True), gr.update(visible=False), ""
109
+ else:
110
+ return gr.update(visible=False), gr.update(visible=True), "Invalid credentials. Try again."
111
+
112
+ # Creating Gradio interface with login page
113
+ with gr.Blocks() as iface:
114
+ gr.Markdown("# GPS Tracker IMEI Writer")
115
+ with gr.Tab("Login"):
116
+ with gr.Row():
117
+ username_input = gr.Textbox(label="Username")
118
+ password_input = gr.Textbox(label="Password", type="password")
119
+ login_button = gr.Button("Login")
120
+
121
+ login_message = gr.Textbox(visible=False)
122
+ imei_writer_interface = gr.Interface(
123
+ fn=start_imei_processing,
124
+ inputs=[],
125
+ outputs="text",
126
+ visible=False,
127
+ title="GPS Tracker IMEI Writer",
128
+ description="Click the button below to start processing IMEI numbers."
129
+ )
130
+
131
+ login_button.click(
132
+ fn=login,
133
+ inputs=[username_input, password_input],
134
+ outputs=[imei_writer_interface, login_message, login_message]
135
+ )
136
 
137
  iface.launch(share=True)