vanand49d48x commited on
Commit
5b01a63
·
verified ·
1 Parent(s): 94fd9bc

Upload folder using huggingface_hub

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
.env ADDED
@@ -0,0 +1,4 @@
 
 
 
 
 
1
+ GEMINI_API_KEY=AIzaSyC4rLyiP8_JbDRX9MxAoyfRbDuNSC0yWx8
2
+ DATABASE_URL=postgres://default:iVbwf9nhs6pO@ep-floral-rice-a4pxkfqr-pooler.us-east-1.aws.neon.tech:5432/verceldb
3
+ PORT=8760
4
+ STRIPE_API_KEY=sk_test_51P9eeaBmFqxDim26JnTtosYT9IThGXNOxcqfWP77hsv6Jfkgh3FGndLErvQMxk1ugO1hcKkmEQjR6qB9W1PmaiVW00qVZD64Rh
.gitattributes CHANGED
@@ -33,3 +33,37 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ venv/bin/ruff filter=lfs diff=lfs merge=lfs -text
37
+ venv/lib/python3.11/site-packages/PIL/.dylibs/libfreetype.6.dylib filter=lfs diff=lfs merge=lfs -text
38
+ venv/lib/python3.11/site-packages/PIL/.dylibs/libharfbuzz.0.dylib filter=lfs diff=lfs merge=lfs -text
39
+ venv/lib/python3.11/site-packages/altair/vegalite/v5/schema/__pycache__/channels.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
40
+ venv/lib/python3.11/site-packages/altair/vegalite/v5/schema/__pycache__/core.cpython-311.pyc filter=lfs diff=lfs merge=lfs -text
41
+ venv/lib/python3.11/site-packages/cryptography/hazmat/bindings/_rust.abi3.so filter=lfs diff=lfs merge=lfs -text
42
+ venv/lib/python3.11/site-packages/fontTools/misc/bezierTools.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
43
+ venv/lib/python3.11/site-packages/gradio/frpc_darwin_arm64_v0.2 filter=lfs diff=lfs merge=lfs -text
44
+ venv/lib/python3.11/site-packages/gradio/templates/frontend/assets/Index-BQLeAZ7H.js.map filter=lfs diff=lfs merge=lfs -text
45
+ venv/lib/python3.11/site-packages/grpc/_cython/cygrpc.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
46
+ venv/lib/python3.11/site-packages/numpy/.dylibs/libgfortran.5.dylib filter=lfs diff=lfs merge=lfs -text
47
+ venv/lib/python3.11/site-packages/numpy/.dylibs/libopenblas64_.0.dylib filter=lfs diff=lfs merge=lfs -text
48
+ venv/lib/python3.11/site-packages/numpy/core/_multiarray_umath.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
49
+ venv/lib/python3.11/site-packages/pandas/_libs/algos.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
50
+ venv/lib/python3.11/site-packages/pandas/_libs/groupby.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
51
+ venv/lib/python3.11/site-packages/pandas/_libs/hashtable.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
52
+ venv/lib/python3.11/site-packages/pandas/_libs/interval.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
53
+ venv/lib/python3.11/site-packages/pandas/_libs/join.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
54
+ venv/lib/python3.11/site-packages/pyarrow/_compute.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
55
+ venv/lib/python3.11/site-packages/pyarrow/_dataset.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
56
+ venv/lib/python3.11/site-packages/pyarrow/_flight.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
57
+ venv/lib/python3.11/site-packages/pyarrow/lib.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
58
+ venv/lib/python3.11/site-packages/pyarrow/libarrow.1601.dylib filter=lfs diff=lfs merge=lfs -text
59
+ venv/lib/python3.11/site-packages/pyarrow/libarrow_acero.1601.dylib filter=lfs diff=lfs merge=lfs -text
60
+ venv/lib/python3.11/site-packages/pyarrow/libarrow_dataset.1601.dylib filter=lfs diff=lfs merge=lfs -text
61
+ venv/lib/python3.11/site-packages/pyarrow/libarrow_flight.1601.dylib filter=lfs diff=lfs merge=lfs -text
62
+ venv/lib/python3.11/site-packages/pyarrow/libarrow_python.dylib filter=lfs diff=lfs merge=lfs -text
63
+ venv/lib/python3.11/site-packages/pyarrow/libarrow_substrait.1601.dylib filter=lfs diff=lfs merge=lfs -text
64
+ venv/lib/python3.11/site-packages/pyarrow/libparquet.1601.dylib filter=lfs diff=lfs merge=lfs -text
65
+ venv/lib/python3.11/site-packages/pydantic_core/_pydantic_core.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
66
+ venv/lib/python3.11/site-packages/pydeck/nbextension/static/index.js.map filter=lfs diff=lfs merge=lfs -text
67
+ venv/lib/python3.11/site-packages/uvloop/loop.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
68
+ venv/lib/python3.11/site-packages/watchfiles/_rust_notify.cpython-311-darwin.so filter=lfs diff=lfs merge=lfs -text
69
+ venv/share/jupyter/nbextensions/pydeck/index.js.map filter=lfs diff=lfs merge=lfs -text
BKP.index.py ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ def login(profile_id, profile_type, visibility):
4
+ # Simulated login check
5
+ if profile_type.lower() == 'user' and profile_id == "123": # Assume "123" is a valid user ID
6
+ visibility.value = True # Update visibility state to True if login is successful
7
+ return "Login Successful"
8
+ else:
9
+ visibility.value = False # Keep the AI tab hidden if login fails
10
+ return "Login Failed"
11
+
12
+ def gradio_interface():
13
+ with gr.Blocks() as app:
14
+ ai_tab_visibility = gr.State(False) # State to control the visibility of the AI Interaction tab
15
+
16
+ with gr.Tabs():
17
+ login_tab = gr.TabItem("Login")
18
+ ai_tab = gr.TabItem("AI Interaction", visible=ai_tab_visibility) # Controlled by state
19
+
20
+ with login_tab:
21
+ profile_id_input = gr.Textbox(label="Enter your User ID")
22
+ profile_type_input = gr.Radio(choices=["User", "Ninja"], label="Select Profile Type")
23
+ login_result = gr.Textbox(label="Login Result", interactive=False)
24
+ login_button = gr.Button("Login")
25
+
26
+ login_button.click(
27
+ fn=login,
28
+ inputs=[profile_id_input, profile_type_input, ai_tab_visibility],
29
+ outputs=login_result
30
+ )
31
+
32
+ with ai_tab:
33
+ gr.Markdown("## AI Interaction Panel")
34
+ # Place your AI interaction components here
35
+
36
+ app.launch()
37
+
38
+ if __name__ == "__main__":
39
+ gradio_interface()
README.md CHANGED
@@ -1,12 +1,6 @@
1
  ---
2
  title: TaskNinja
3
- emoji: 💻
4
- colorFrom: gray
5
- colorTo: red
6
  sdk: gradio
7
- sdk_version: 4.32.1
8
- app_file: app.py
9
- pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: TaskNinja
3
+ app_file: index.py
 
 
4
  sdk: gradio
5
+ sdk_version: 4.31.2
 
 
6
  ---
 
 
index.py ADDED
@@ -0,0 +1,909 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import gradio as gr
3
+ import google.generativeai as genai
4
+ import psycopg2
5
+ import json
6
+ import logging
7
+ import time
8
+ from dotenv import load_dotenv
9
+ import re
10
+ import stripe
11
+
12
+ # Load environment variables from .env file
13
+ load_dotenv()
14
+
15
+ # Set up basic configuration for logging
16
+ logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(levelname)s - %(message)s')
17
+
18
+ # Configure Stripe API
19
+ stripe.api_key = os.getenv("STRIPE_API_KEY")
20
+
21
+ # Configure the Google AI model
22
+ genai.configure(api_key=os.getenv("GEMINI_API_KEY"))
23
+
24
+ # Create the model with predefined configuration
25
+ generation_config = {
26
+ "temperature": 1,
27
+ "top_p": 0.95,
28
+ "top_k": 64,
29
+ "max_output_tokens": 8192,
30
+ "response_mime_type": "text/plain",
31
+ }
32
+ safety_settings = [
33
+ {"category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
34
+ {"category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
35
+ {"category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
36
+ {"category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE"},
37
+ ]
38
+
39
+ model = genai.GenerativeModel(
40
+ model_name="gemini-1.5-flash-latest",
41
+ safety_settings=safety_settings,
42
+ generation_config=generation_config,
43
+ )
44
+
45
+ # In-memory cache for profiles
46
+ profiles_cache = {
47
+ "data": None,
48
+ "timestamp": None,
49
+ "cache_duration": 60 * 5 # Cache duration in seconds (5 minutes)
50
+ }
51
+
52
+ def get_database_connection():
53
+ database_url = os.getenv("DATABASE_URL")
54
+ if not database_url:
55
+ logging.error("DATABASE_URL is not set in environment variables.")
56
+ raise ValueError("DATABASE_URL is not set in environment variables.")
57
+ try:
58
+ return psycopg2.connect(database_url)
59
+ except Exception as e:
60
+ logging.error(f"Failed to connect to the database: {e}")
61
+ raise
62
+
63
+ def fetch_profiles():
64
+ global profiles_cache
65
+ current_time = time.time()
66
+
67
+ # Check if cache is valid
68
+ if profiles_cache["data"] and (current_time - profiles_cache["timestamp"] < profiles_cache["cache_duration"]):
69
+ logging.info("Using cached profiles data.")
70
+ return profiles_cache["data"]
71
+
72
+ logging.info("Fetching profiles from database.")
73
+ conn = get_database_connection()
74
+ profiles = []
75
+ try:
76
+ with conn.cursor() as curs:
77
+ curs.execute("SELECT name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic FROM gig_workers")
78
+ for row in curs.fetchall():
79
+ skills = json.loads(row[2]) if isinstance(row[2], str) else row[2]
80
+ profile = {
81
+ "Name": row[0],
82
+ "About": row[1],
83
+ "Skills": skills,
84
+ "Rating": row[3],
85
+ "Trust Score": row[4],
86
+ "Ninja Level": row[5],
87
+ "Task Experience": row[6],
88
+ "Online Status": row[7],
89
+ "Profile Pic": row[8]
90
+ }
91
+ profiles.append(profile)
92
+ except Exception as e:
93
+ logging.error(f"Error fetching profiles: {e}")
94
+ raise
95
+ finally:
96
+ conn.close()
97
+
98
+ # Update cache
99
+ profiles_cache["data"] = profiles
100
+ profiles_cache["timestamp"] = current_time
101
+
102
+ return profiles
103
+
104
+ def add_person(name, about, profile_type, skills=None, rating=None, level=None):
105
+ conn = get_database_connection()
106
+ try:
107
+ with conn.cursor() as curs:
108
+ if profile_type == 'User':
109
+ curs.execute("""
110
+ INSERT INTO users (name, about, level) VALUES (%s, %s, %s) RETURNING user_id
111
+ """, (name, about, level))
112
+ else:
113
+ curs.execute("""
114
+ INSERT INTO ninjas (name, skills, rating) VALUES (%s, %s, %s) RETURNING ninja_id
115
+ """, (name, json.dumps(skills.split(', ')), rating))
116
+ profile_id = curs.fetchone()[0]
117
+ conn.commit()
118
+ return f"{profile_type} added with ID: {profile_id}"
119
+ finally:
120
+ conn.close()
121
+
122
+ # Function to fetch User or Ninja details
123
+ def fetch_details(profile_id, profile_type):
124
+ conn = get_database_connection()
125
+ try:
126
+ with conn.cursor() as curs:
127
+ if profile_type == 'User':
128
+ curs.execute("SELECT name, about, level FROM users WHERE user_id = %s", (profile_id,))
129
+ else:
130
+ curs.execute("SELECT name, skills, rating FROM ninjas WHERE ninja_id = %s", (profile_id,))
131
+ details = curs.fetchone()
132
+ return details if details else f"No {profile_type} found with the given ID."
133
+ finally:
134
+ conn.close()
135
+
136
+ def fetch_users():
137
+ conn = get_database_connection()
138
+ users = []
139
+ try:
140
+ with conn.cursor() as curs:
141
+ curs.execute("SELECT user_id, name, profile_name, about, trust_score, online_status, profile_pic, level FROM users")
142
+ for row in curs.fetchall():
143
+ user = {
144
+ "User ID": row[0],
145
+ "Name": row[1],
146
+ "Profile Name": row[2],
147
+ "About": row[3],
148
+ "Trust Score": row[4],
149
+ "Online Status": row[5],
150
+ "Profile Pic": row[6],
151
+ "Level": row[7],
152
+ }
153
+ users.append(user)
154
+ except Exception as e:
155
+ logging.error(f"Error fetching users: {e}")
156
+ raise
157
+ finally:
158
+ conn.close()
159
+
160
+ return users
161
+
162
+ def add_user(name, profile_name, about, trust_score, online_status, profile_pic, level):
163
+ conn = get_database_connection()
164
+ try:
165
+ with conn.cursor() as curs:
166
+ curs.execute("""
167
+ INSERT INTO users (name, profile_name, about, trust_score, online_status, profile_pic, level)
168
+ VALUES (%s, %s, %s, %s, %s, %s, %s) RETURNING user_id
169
+ """, (name, profile_name, about, trust_score, online_status, profile_pic, level))
170
+ user_id = curs.fetchone()[0]
171
+ conn.commit()
172
+ logging.info(f"User added with ID: {user_id}")
173
+ return f"User added with ID: {user_id}"
174
+ except Exception as e:
175
+ logging.error(f"Error adding user: {e}")
176
+ conn.rollback()
177
+ return f"Error adding user: {e}"
178
+ finally:
179
+ conn.close()
180
+
181
+ def user_exists(user_id):
182
+ conn = get_database_connection()
183
+ try:
184
+ with conn.cursor() as curs:
185
+ curs.execute("SELECT 1 FROM users WHERE user_id = %s", (user_id,))
186
+ return curs.fetchone() is not None
187
+ except Exception as e:
188
+ logging.error(f"Error checking user existence: {e}")
189
+ return False
190
+ finally:
191
+ conn.close()
192
+
193
+ def remove_markdown_bold(text):
194
+ return re.sub(r'\*\*(.*?)\*\*', r'\1', text)
195
+
196
+ def ask_model_questions(task_description, history=None):
197
+ if history is None:
198
+ history = []
199
+
200
+ chat_session = model.start_chat(history=history)
201
+
202
+ prompt = (f"As an expert in the field related to the task description: '{task_description}', "
203
+ "what additional information do you need to better understand the task requirements? "
204
+ "Please provide your questions in the following format:\n"
205
+ "Question 1: [Your question here]?\n"
206
+ "Question 2: [Your question here]?\n"
207
+ "...\n"
208
+ "If you have enough information, please type 'Enough information'.")
209
+
210
+ response = chat_session.send_message(prompt)
211
+ history.append({"prompt": prompt, "response": response.text})
212
+
213
+ if "enough information" in response.text.lower():
214
+ return None, history
215
+
216
+ return remove_markdown_bold(response.text), history
217
+
218
+ def refine_task_description(task_description, question_answers, history=None):
219
+ if history is None:
220
+ history = []
221
+
222
+ chat_session = model.start_chat(history=history)
223
+
224
+ prompt = (f"Original task description: {task_description}\n\n"
225
+ f"Additional information provided:\n{question_answers}\n\n"
226
+ "Based on the original task description and the additional information provided, "
227
+ "please provide a complete and refined task description.")
228
+
229
+ response = chat_session.send_message(prompt)
230
+ history.append({"prompt": prompt, "response": response.text})
231
+
232
+ return remove_markdown_bold(response.text), history
233
+
234
+ def find_best_profile(task_description):
235
+ profiles = fetch_profiles()
236
+ chat_session = model.start_chat()
237
+
238
+ prompt = (f"Based on the complete task description: {task_description}\n\n"
239
+ "Evaluate the suitability of the following gig worker profiles "
240
+ "and provide the name of the best-matched profile along with an explanation in the following format:\n"
241
+ "Name: [Best-matched profile name]\n"
242
+ "Why [Best-matched profile name]? [Explanation]\n\nProfiles:\n")
243
+ for i, profile in enumerate(profiles, start=1):
244
+ prompt += (f"{i}. Name: {profile['Name']}, Skills: {', '.join(profile['Skills'])}, Experience: {profile['Task Experience']} hours, "
245
+ f"Rating: {profile['Rating']}, Trust Score: {profile['Trust Score']}, Online Status: {profile['Online Status']}, Profile Pic: {profile['Profile Pic']}\n")
246
+
247
+ response = chat_session.send_message(prompt)
248
+ return remove_markdown_bold(response.text)
249
+
250
+ # Backend Functions for Task and User Profile Management
251
+
252
+ def post_task(user_id, task_description, additional_info):
253
+ if not user_id or not task_description:
254
+ logging.error("User ID and Task Description are required")
255
+ return "User ID and Task Description are required"
256
+ if not user_exists(user_id):
257
+ logging.error(f"User ID {user_id} does not exist")
258
+ return f"User ID {user_id} does not exist"
259
+
260
+ conn = get_database_connection()
261
+ try:
262
+ with conn.cursor() as curs:
263
+ curs.execute("""
264
+ INSERT INTO tasks (user_id, task_description, additional_info)
265
+ VALUES (%s, %s, %s) RETURNING task_id
266
+ """, (user_id, task_description, additional_info))
267
+ task_id = curs.fetchone()[0]
268
+ conn.commit()
269
+ logging.info(f"Task posted with ID: {task_id}")
270
+ return f"Task posted with ID: {task_id}"
271
+ except Exception as e:
272
+ logging.error(f"Error posting task: {e}")
273
+ conn.rollback()
274
+ return f"Error posting task: {e}"
275
+ finally:
276
+ conn.close()
277
+
278
+ def update_task_status(task_id, status):
279
+ if not task_id or not status:
280
+ logging.error("Task ID and Status are required")
281
+ return "Task ID and Status are required"
282
+
283
+ conn = get_database_connection()
284
+ try:
285
+ with conn.cursor() as curs:
286
+ curs.execute("""
287
+ UPDATE tasks SET status = %s, updated_at = CURRENT_TIMESTAMP WHERE task_id = %s
288
+ """, (status, task_id))
289
+ conn.commit()
290
+ logging.info(f"Task {task_id} status updated to {status}")
291
+ return f"Task {task_id} status updated to {status}"
292
+ except Exception as e:
293
+ logging.error(f"Error updating task status: {e}")
294
+ conn.rollback()
295
+ return f"Error updating task status: {e}"
296
+ finally:
297
+ conn.close()
298
+
299
+ def get_task_progress(task_id):
300
+ if not task_id:
301
+ logging.error("Task ID is required")
302
+ return "Task ID is required"
303
+
304
+ conn = get_database_connection()
305
+ progress = []
306
+ try:
307
+ with conn.cursor() as curs:
308
+ curs.execute("""
309
+ SELECT update_text, updated_at FROM task_progress WHERE task_id = %s ORDER BY updated_at DESC
310
+ """, (task_id,))
311
+ for row in curs.fetchall():
312
+ progress.append({"update_text": row[0], "updated_at": row[1]})
313
+ except Exception as e:
314
+ logging.error(f"Error fetching task progress: {e}")
315
+ return f"Error fetching task progress: {e}"
316
+ finally:
317
+ conn.close()
318
+ return progress
319
+
320
+ def update_task_progress(task_id, update_text):
321
+ if not task_id or not update_text:
322
+ logging.error("Task ID and Progress Update Text are required")
323
+ return "Task ID and Progress Update Text are required"
324
+
325
+ conn = get_database_connection()
326
+ try:
327
+ with conn.cursor() as curs:
328
+ curs.execute("""
329
+ INSERT INTO task_progress (task_id, update_text) VALUES (%s, %s)
330
+ """, (task_id, update_text))
331
+ conn.commit()
332
+ logging.info(f"Progress for task {task_id} updated")
333
+ return f"Progress for task {task_id} updated"
334
+ except Exception as e:
335
+ logging.error(f"Error updating task progress: {e}")
336
+ conn.rollback()
337
+ return f"Error updating task progress: {e}"
338
+ finally:
339
+ conn.close()
340
+
341
+ def upload_task_result(task_id, result_file):
342
+ if not task_id or not result_file:
343
+ logging.error("Task ID and Result File are required")
344
+ return "Task ID and Result File are required"
345
+
346
+ # Save the uploaded file to a location and get its URL
347
+ result_url = f"task_results/{task_id}.pdf"
348
+ result_file.save(result_url)
349
+
350
+ conn = get_database_connection()
351
+ try:
352
+ with conn.cursor() as curs:
353
+ curs.execute("""
354
+ UPDATE tasks SET result_url = %s WHERE task_id = %s
355
+ """, (result_url, task_id))
356
+ conn.commit()
357
+ logging.info(f"Result for task {task_id} uploaded")
358
+ return f"Result for task {task_id} uploaded"
359
+ except Exception as e:
360
+ logging.error(f"Error uploading task result: {e}")
361
+ conn.rollback()
362
+ return f"Error uploading task result: {e}"
363
+ finally:
364
+ conn.close()
365
+
366
+ def update_user_online_status(user_id, online_status):
367
+ if not user_id:
368
+ logging.error("User ID is required")
369
+ return "User ID is required"
370
+
371
+ conn = get_database_connection()
372
+ try:
373
+ with conn.cursor() as curs:
374
+ # Check if user exists
375
+ curs.execute("SELECT 1 FROM users WHERE user_id = %s", (user_id,))
376
+ if curs.fetchone() is None:
377
+ logging.error(f"User ID {user_id} does not exist")
378
+ return f"User ID {user_id} does not exist"
379
+
380
+ # Update the online status if user exists
381
+ curs.execute("""
382
+ UPDATE users SET online_status = %s WHERE user_id = %s
383
+ """, (online_status, user_id))
384
+ conn.commit()
385
+ logging.info(f"User {user_id} online status updated to {online_status}")
386
+ return f"User {user_id} online status updated to {online_status}"
387
+ except Exception as e:
388
+ logging.error(f"Error updating user online status: {e}")
389
+ conn.rollback()
390
+ return f"Error updating user online status: {e}"
391
+ finally:
392
+ conn.close()
393
+
394
+ def update_user_profile_pic(user_id, profile_pic_file):
395
+ if not user_id or not profile_pic_file:
396
+ logging.error("User ID and Profile Picture File are required")
397
+ return "User ID and Profile Picture File are required"
398
+
399
+ # Save the uploaded file to a location and get its URL
400
+ profile_pic_url = f"profile_pictures/{user_id}.png"
401
+ profile_pic_file.save(profile_pic_url)
402
+
403
+ conn = get_database_connection()
404
+ try:
405
+ with conn.cursor() as curs:
406
+ curs.execute("""
407
+ UPDATE users SET profile_pic = %s WHERE user_id = %s
408
+ """, (profile_pic_url, user_id))
409
+ conn.commit()
410
+ logging.info(f"User {user_id} profile picture updated")
411
+ return f"User {user_id} profile picture updated"
412
+ except Exception as e:
413
+ logging.error(f"Error updating user profile picture: {e}")
414
+ conn.rollback()
415
+ return f"Error updating user profile picture: {e}"
416
+ finally:
417
+ conn.close()
418
+
419
+ def add_gig_worker(name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic_file):
420
+ if not name:
421
+ logging.error("Name is required")
422
+ return "Name is required"
423
+
424
+ profile_pic_url = f"profile_pictures/{name}.png"
425
+ profile_pic_file.save(profile_pic_url)
426
+
427
+ conn = get_database_connection()
428
+ try:
429
+ with conn.cursor() as curs:
430
+ curs.execute("""
431
+ INSERT INTO gig_workers (name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic)
432
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s) RETURNING id
433
+ """, (name, about, json.dumps(skills), rating, trust_score, ninja_level, task_experience, online_status, profile_pic_url))
434
+ id = curs.fetchone()[0]
435
+ conn.commit()
436
+ logging.info(f"Gig worker added with ID: {id}")
437
+ return f"Gig worker added with ID: {id}"
438
+ except Exception as e:
439
+ logging.error(f"Error adding gig worker: {e}")
440
+ conn.rollback()
441
+ return f"Error adding gig worker: {e}"
442
+ finally:
443
+ conn.close()
444
+
445
+ def update_gig_worker(worker_id, name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic_file):
446
+ if not worker_id:
447
+ logging.error("Worker ID is required")
448
+ return "Worker ID is required"
449
+
450
+ profile_pic_url = f"profile_pictures/{worker_id}.png"
451
+ profile_pic_file.save(profile_pic_url)
452
+
453
+ conn = get_database_connection()
454
+ try:
455
+ with conn.cursor() as curs:
456
+ curs.execute("""
457
+ UPDATE gig_workers
458
+ SET name = %s, about = %s, skills = %s, rating = %s, trust_score = %s, ninja_level = %s, task_experience = %s, online_status = %s, profile_pic = %s
459
+ WHERE id = %s
460
+ """, (name, about, json.dumps(skills), rating, trust_score, ninja_level, task_experience, online_status, profile_pic_url, worker_id))
461
+ conn.commit()
462
+ logging.info(f"Gig worker {worker_id} updated")
463
+ return f"Gig worker {worker_id} updated"
464
+ except Exception as e:
465
+ logging.error(f"Error updating gig worker: {e}")
466
+ conn.rollback()
467
+ return f"Error updating gig worker: {e}"
468
+ finally:
469
+ conn.close()
470
+
471
+ def fetch_gig_worker(worker_id):
472
+ if not worker_id:
473
+ logging.error("Worker ID is required")
474
+ return {"error": "Worker ID is required"}
475
+
476
+ conn = get_database_connection()
477
+ worker = None
478
+ try:
479
+ with conn.cursor() as curs:
480
+ curs.execute("""
481
+ SELECT name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic
482
+ FROM gig_workers WHERE id = %s
483
+ """, (worker_id,))
484
+ row = curs.fetchone()
485
+ if row:
486
+ skills = json.loads(row[2]) if isinstance(row[2], str) else row[2]
487
+ worker = {
488
+ "Name": row[0],
489
+ "About": row[1],
490
+ "Skills": skills,
491
+ "Rating": row[3],
492
+ "Trust Score": row[4],
493
+ "Ninja Level": row[5],
494
+ "Task Experience": row[6],
495
+ "Online Status": row[7],
496
+ "Profile Pic": row[8]
497
+ }
498
+ else:
499
+ return {"error": f"No worker found with ID {worker_id}"}
500
+ except Exception as e:
501
+ logging.error(f"Error fetching gig worker: {e}")
502
+ return {"error": f"Error fetching gig worker: {e}"}
503
+ finally:
504
+ conn.close()
505
+ return worker
506
+
507
+ def create_payment_session(amount, currency, success_url, cancel_url):
508
+ try:
509
+ session = stripe.checkout.Session.create(
510
+ payment_method_types=['card'],
511
+ line_items=[{
512
+ 'price_data': {
513
+ 'currency': currency,
514
+ 'product_data': {
515
+ 'name': 'Service Payment',
516
+ },
517
+ 'unit_amount': int(amount * 100), # Stripe uses the smallest currency unit
518
+ },
519
+ 'quantity': 1,
520
+ }],
521
+ mode='payment',
522
+ success_url=success_url,
523
+ cancel_url=cancel_url,
524
+ )
525
+ logging.info(f"Payment session created: {session['id']}")
526
+ return session.url
527
+ except Exception as e:
528
+ logging.error(f"Error creating payment session: {e}")
529
+ return f"Error creating payment session: {e}"
530
+
531
+ def get_database_connection():
532
+ database_url = os.getenv("DATABASE_URL")
533
+ if not database_url:
534
+ logging.error("DATABASE_URL is not set in environment variables.")
535
+ raise ValueError("DATABASE_URL is not set in environment variables.")
536
+ try:
537
+ return psycopg2.connect(database_url)
538
+ except Exception as e:
539
+ logging.error(f"Failed to connect to the database: {e}")
540
+ raise
541
+
542
+ def fetch_user(user_id):
543
+ logging.debug(f"Fetching User 1: {user_id}")
544
+ conn = get_database_connection()
545
+ try:
546
+ with conn.cursor() as curs:
547
+ logging.debug(f"Fetching User 2: {user_id}")
548
+ curs.execute("SELECT name FROM users WHERE user_id = %s", (user_id,))
549
+ user = curs.fetchone()
550
+ if user:
551
+ logging.debug(f"Fetched User: {user}")
552
+ return True, {"name": user[0], "user_id": user_id}
553
+ else:
554
+ return False, "No user found with ID: {}".format(user_id)
555
+ finally:
556
+ conn.close()
557
+
558
+ def fetch_ninja(ninja_id):
559
+ conn = get_database_connection()
560
+ try:
561
+ with conn.cursor() as curs:
562
+ curs.execute("SELECT name FROM ninjas WHERE ninja_id = %s", (ninja_id,))
563
+ ninja = curs.fetchone()
564
+ if ninja:
565
+ return True, {"name": ninja[0], "ninja_id": ninja_id}
566
+ else:
567
+ return False, "No ninja found with ID: {}".format(ninja_id)
568
+ finally:
569
+ conn.close()
570
+
571
+ def login(profile_id, profile_type):
572
+ try:
573
+ if profile_type.lower() == 'user':
574
+ success, details = fetch_user(profile_id)
575
+ elif profile_type.lower() == 'ninja':
576
+ success, details = fetch_ninja(profile_id)
577
+ else:
578
+ return "Invalid profile type", False
579
+
580
+ if success:
581
+ return "Login Successful", True
582
+ else:
583
+ return details, False
584
+ except Exception as e:
585
+ return str(e), False
586
+
587
+
588
+ def gradio_interface():
589
+ logging.debug("Starting Gradio interface")
590
+ with gr.Blocks(css=".gradio-container {background-color: #f4f4f4}") as iface:
591
+ ai_tab_visibility = gr.State(False)
592
+ logging.debug(f"BEFORE VISIBILITY: {ai_tab_visibility.value}")
593
+ with gr.Tabs() as tabs:
594
+ # Existing tabs here...
595
+
596
+ login_tab = gr.TabItem("Login")
597
+
598
+
599
+ with login_tab:
600
+ profile_id_input = gr.Textbox(label="Enter your User ID")
601
+ profile_type_input = gr.Radio(choices=["User", "Ninja"], label="Select Profile Type")
602
+ login_button = gr.Button("Login")
603
+ login_result = gr.Textbox(label="Login Result", interactive=False)
604
+ ai_tab_visibility = gr.State(False) # State to control the visibility of the AI Tab
605
+
606
+ def update_visibility(result, visible):
607
+ ai_tab_visibility.value = visible # Update the visibility based on login success
608
+ return result, visible
609
+
610
+ login_button.click(
611
+ fn=lambda profile_id, profile_type: update_visibility(*login(profile_id, profile_type)),
612
+ inputs=[profile_id_input, profile_type_input],
613
+ outputs=[login_result, ai_tab_visibility]
614
+ )
615
+
616
+
617
+ with gr.TabItem("AI Interaction", visible=ai_tab_visibility.value) as ai_tab:
618
+
619
+ gr.Markdown("Enter a task description and interact with the AI. Provide additional details if prompted by the AI for more information.")
620
+
621
+ task_description = gr.Textbox(label="Enter your task description")
622
+
623
+ with gr.Column(visible=False) as question_column:
624
+ model_questions = gr.Textbox(label="Model Questions", interactive=False)
625
+ question_answers = gr.Textbox(label="Your Answer", placeholder="Type your answer here...")
626
+ question_submit_button = gr.Button(value="Submit", variant="primary")
627
+
628
+ refined_task_description = gr.Textbox(label="Refined Task Description", visible=False)
629
+ find_button = gr.Button(value="Find", visible=False)
630
+ best_matched_profile = gr.Textbox(label="Best Matched Profile", visible=False)
631
+ reset_button = gr.Button(value="Reset", variant="secondary")
632
+
633
+ question_history = gr.State([])
634
+ refine_history = gr.State([])
635
+
636
+ def process_task_questions(task_description, question_history):
637
+ logging.debug(f"Processing task questions for task description: {task_description}")
638
+ questions, updated_history = ask_model_questions(task_description, question_history)
639
+
640
+ if questions:
641
+ logging.debug(f"Questions from AI: {questions}")
642
+ return gr.update(value=questions, visible=True), gr.update(visible=True), gr.update(visible=True), updated_history
643
+ else:
644
+ logging.debug("No additional questions from AI.")
645
+ return gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), updated_history
646
+
647
+ def process_task_refinement(task_description, question_answers, refine_history):
648
+ refined_description, updated_history = refine_task_description(task_description, question_answers, refine_history)
649
+ return gr.update(value=refined_description, visible=True), gr.update(visible=True), updated_history
650
+
651
+ def find_best_profile_event(complete_task_description):
652
+ best_profile = find_best_profile(complete_task_description)
653
+ return gr.update(value=best_profile, visible=True)
654
+
655
+ def reset_interface():
656
+ return (
657
+ "",
658
+ gr.update(visible=False),
659
+ gr.update(value="", visible=False),
660
+ gr.update(visible=False),
661
+ gr.update(visible=False),
662
+ "",
663
+ [],
664
+ []
665
+ )
666
+
667
+ task_description.submit(process_task_questions, [task_description, question_history], [model_questions, question_column, question_history])
668
+ question_submit_button.click(process_task_refinement, [task_description, question_answers, refine_history], [refined_task_description, find_button, refine_history])
669
+ find_button.click(find_best_profile_event, inputs=refined_task_description, outputs=best_matched_profile)
670
+ reset_button.click(reset_interface, None, [task_description, model_questions, question_column, refined_task_description, find_button, best_matched_profile, question_history, refine_history])
671
+
672
+ # Add custom CSS styles to remove bold text in text fields
673
+ iface.css += """
674
+ .gradio-interface .gradio-textbox {
675
+ font-weight: normal;
676
+ }
677
+ """
678
+
679
+ with gr.TabItem("Task Management"):
680
+ gr.Markdown("Manage tasks.")
681
+
682
+ # Post Task
683
+ post_task_user_id = gr.Number(label="User ID")
684
+ post_task_description = gr.Textbox(label="Task Description")
685
+ post_task_additional_info = gr.Textbox(label="Additional Info")
686
+ post_task_button = gr.Button(value="Post Task")
687
+ post_task_output = gr.Textbox(label="Post Task Output")
688
+
689
+ def handle_post_task(user_id, description, additional_info):
690
+ logging.debug(f"Posting task for user {user_id} with description: {description}")
691
+ result = post_task(user_id, description, additional_info)
692
+ logging.debug(f"Post task result: {result}")
693
+ return result
694
+
695
+ post_task_button.click(handle_post_task, inputs=[post_task_user_id, post_task_description, post_task_additional_info], outputs=post_task_output)
696
+
697
+ # Update Task Status
698
+ update_task_id = gr.Number(label="Task ID")
699
+ update_task_status_input = gr.Textbox(label="Status")
700
+ update_task_status_button = gr.Button(value="Update Task Status")
701
+ update_task_status_output = gr.Textbox(label="Update Task Status Output")
702
+
703
+ def handle_update_task_status(task_id, status):
704
+ logging.debug(f"Updating task status for task {task_id} to {status}")
705
+ result = update_task_status(task_id, status)
706
+ logging.debug(f"Update task status result: {result}")
707
+ return result
708
+
709
+ update_task_status_button.click(handle_update_task_status, inputs=[update_task_id, update_task_status_input], outputs=update_task_status_output)
710
+
711
+ # Get Task Progress
712
+ get_progress_task_id = gr.Number(label="Task ID")
713
+ get_progress_button = gr.Button(value="Get Task Progress")
714
+ get_progress_output = gr.JSON(label="Task Progress Output")
715
+
716
+ def handle_get_task_progress(task_id):
717
+ logging.debug(f"Fetching task progress for task {task_id}")
718
+ result = get_task_progress(task_id)
719
+ logging.debug(f"Task progress: {result}")
720
+ return result
721
+
722
+ get_progress_button.click(handle_get_task_progress, inputs=get_progress_task_id, outputs=get_progress_output)
723
+
724
+ # Update Task Progress
725
+ update_progress_task_id = gr.Number(label="Task ID")
726
+ update_progress_text = gr.Textbox(label="Update Text")
727
+ update_progress_button = gr.Button(value="Update Task Progress")
728
+ update_progress_output = gr.Textbox(label="Update Task Progress Output")
729
+
730
+ def handle_update_task_progress(task_id, update_text):
731
+ logging.debug(f"Updating task progress for task {task_id} with text: {update_text}")
732
+ result = update_task_progress(task_id, update_text)
733
+ logging.debug(f"Update task progress result: {result}")
734
+ return result
735
+
736
+ update_progress_button.click(handle_update_task_progress, inputs=[update_progress_task_id, update_progress_text], outputs=update_progress_output)
737
+
738
+ # Upload Task Result
739
+ upload_result_task_id = gr.Number(label="Task ID")
740
+ upload_result_file = gr.File(label="Task Result")
741
+ upload_result_button = gr.Button(value="Upload Task Result")
742
+ upload_result_output = gr.Textbox(label="Upload Task Result Output")
743
+
744
+ def handle_upload_task_result(task_id, result_file):
745
+ logging.debug(f"Uploading task result for task {task_id}")
746
+ result = upload_task_result(task_id, result_file)
747
+ logging.debug(f"Upload task result: {result}")
748
+ return result
749
+
750
+ upload_result_button.click(handle_upload_task_result, inputs=[upload_result_task_id, upload_result_file], outputs=upload_result_output)
751
+
752
+ with gr.TabItem("User Management"):
753
+ gr.Markdown("Manage user profiles.")
754
+
755
+
756
+ # Add User
757
+ level_options = ["Academy Student", "Genin Requester", "Chunin Requester", "Jonin Requester", "Kage Requester"]
758
+ trust_score_options = list(range(1, 11)) # Generates numbers from 1 to 10
759
+
760
+ # Add User
761
+ add_user_name = gr.Textbox(label="Name")
762
+ add_user_profile_name = gr.Textbox(label="Profile Name")
763
+ add_user_about = gr.Textbox(label="About")
764
+ add_user_level = gr.Dropdown(label="Level", choices=level_options)
765
+ add_user_trust_score = gr.Dropdown(label="Trust Score", choices=trust_score_options)
766
+ add_user_online_status = gr.Checkbox(label="Online Status")
767
+ add_user_profile_pic = gr.File(label="Profile Picture")
768
+ add_user_button = gr.Button(value="Add User")
769
+ add_user_output = gr.Textbox(label="Add User Output")
770
+
771
+ def handle_add_user(name, profile_name, about, trust_score, online_status, profile_pic_file, level):
772
+ logging.debug(f"Adding user: {name}")
773
+ result = add_user(name, profile_name, about, trust_score, online_status, profile_pic_file, level)
774
+ logging.debug(f"Add user result: {result}")
775
+ return result
776
+
777
+ add_user_button.click(handle_add_user, inputs=[
778
+ add_user_name, add_user_profile_name, add_user_about,
779
+ add_user_trust_score, add_user_online_status,
780
+ add_user_profile_pic, add_user_level], outputs=add_user_output)
781
+
782
+ # Fetch Users
783
+ fetch_users_button = gr.Button(value="Fetch Users")
784
+ fetch_users_output = gr.JSON(label="Fetch Users Output")
785
+
786
+ def handle_fetch_users():
787
+ logging.debug("Fetching all users")
788
+ result = fetch_users()
789
+ logging.debug(f"Fetched users: {result}")
790
+ return result
791
+
792
+ fetch_users_button.click(handle_fetch_users, outputs=fetch_users_output)
793
+
794
+ # Update User Online Status
795
+ update_online_status_user_id = gr.Number(label="User ID")
796
+ update_online_status = gr.Checkbox(label="Online Status")
797
+ update_online_status_button = gr.Button(value="Update Online Status")
798
+ update_online_status_output = gr.Textbox(label="Update Online Status Output")
799
+
800
+ def handle_update_online_status(user_id, online_status):
801
+ logging.debug(f"Updating online status for user {user_id} to {online_status}")
802
+ result = update_user_online_status(user_id, online_status)
803
+ logging.debug(f"Update online status result: {result}")
804
+ return result
805
+
806
+ update_online_status_button.click(handle_update_online_status, inputs=[update_online_status_user_id, update_online_status], outputs=update_online_status_output)
807
+
808
+ # Update User Profile Picture
809
+ update_profile_pic_user_id = gr.Number(label="User ID")
810
+ update_profile_pic_file = gr.File(label="Profile Picture")
811
+ update_profile_pic_button = gr.Button(value="Update Profile Picture")
812
+ update_profile_pic_output = gr.Textbox(label="Update Profile Picture Output")
813
+
814
+ def handle_update_profile_pic(user_id, profile_pic_file):
815
+ logging.debug(f"Updating profile picture for user {user_id}")
816
+ result = update_user_profile_pic(user_id, profile_pic_file)
817
+ logging.debug(f"Update profile picture result: {result}")
818
+ return result
819
+
820
+ update_profile_pic_button.click(handle_update_profile_pic, inputs=[update_profile_pic_user_id, update_profile_pic_file], outputs=update_profile_pic_output)
821
+
822
+ with gr.TabItem("Gig Worker Management"):
823
+ gr.Markdown("Manage gig worker profiles.")
824
+
825
+ level_options = ["Genin", "Chunin", "Jonin", "ANBU", "Kage", "Sage"]
826
+ rating_score_options = list(range(1, 6))
827
+ trust_score_options = list(range(1, 11)) # Generates numbers from 1 to 10
828
+ # Add Gig Worker
829
+ add_worker_name = gr.Textbox(label="Name")
830
+ add_worker_about = gr.Textbox(label="About")
831
+ add_worker_skills = gr.Textbox(label="Skills (comma-separated)")
832
+ add_worker_rating = gr.Dropdown(label="Rating", choices=rating_score_options)
833
+ add_worker_trust_score = gr.Dropdown(label="Trust Score", choices=trust_score_options)
834
+ add_worker_ninja_level = gr.Dropdown(label="Ninja Level", choices=level_options)
835
+ add_worker_task_experience = gr.Number(label="Task Experience")
836
+ add_worker_online_status = gr.Checkbox(label="Online Status")
837
+ add_worker_profile_pic = gr.File(label="Profile Picture")
838
+ add_worker_button = gr.Button(value="Add Worker")
839
+ add_worker_output = gr.Textbox(label="Add Worker Output")
840
+
841
+ def handle_add_worker(name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic_file):
842
+ skills_list = skills.split(",") if skills else []
843
+ logging.debug(f"Adding gig worker: {name}")
844
+ result = add_gig_worker(name, about, skills_list, rating, trust_score, ninja_level, task_experience, online_status, profile_pic_file)
845
+ logging.debug(f"Add gig worker result: {result}")
846
+ return result
847
+
848
+ add_worker_button.click(handle_add_worker, inputs=[add_worker_name, add_worker_about, add_worker_skills, add_worker_rating, add_worker_trust_score, add_worker_ninja_level, add_worker_task_experience, add_worker_online_status, add_worker_profile_pic], outputs=add_worker_output)
849
+
850
+ # Update Gig Worker
851
+ update_worker_id = gr.Number(label="Worker ID")
852
+ update_worker_name = gr.Textbox(label="Name")
853
+ update_worker_about = gr.Textbox(label="About")
854
+ update_worker_skills = gr.Textbox(label="Skills (comma-separated)")
855
+ update_worker_rating = gr.Number(label="Rating")
856
+ update_worker_trust_score = gr.Number(label="Trust Score")
857
+ update_worker_ninja_level = gr.Number(label="Ninja Level")
858
+ update_worker_task_experience = gr.Number(label="Task Experience")
859
+ update_worker_online_status = gr.Checkbox(label="Online Status")
860
+ update_worker_profile_pic = gr.File(label="Profile Picture")
861
+ update_worker_button = gr.Button(value="Update Worker")
862
+ update_worker_output = gr.Textbox(label="Update Worker Output")
863
+
864
+ def handle_update_worker(worker_id, name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic_file):
865
+ skills_list = skills.split(",") if skills else []
866
+ logging.debug(f"Updating gig worker: {worker_id}")
867
+ result = update_gig_worker(worker_id, name, about, skills_list, rating, trust_score, ninja_level, task_experience, online_status, profile_pic_file)
868
+ logging.debug(f"Update gig worker result: {result}")
869
+ return result
870
+
871
+ update_worker_button.click(handle_update_worker, inputs=[update_worker_id, update_worker_name, update_worker_about, update_worker_skills, update_worker_rating, update_worker_trust_score, update_worker_ninja_level, update_worker_task_experience, update_worker_online_status, update_worker_profile_pic], outputs=update_worker_output)
872
+
873
+ # Fetch Gig Worker
874
+ fetch_worker_id = gr.Number(label="Worker ID")
875
+ fetch_worker_button = gr.Button(value="Fetch Worker")
876
+ fetch_worker_output = gr.JSON(label="Fetch Worker Output")
877
+
878
+ def handle_fetch_worker(worker_id):
879
+ logging.debug(f"Fetching gig worker: {worker_id}")
880
+ result = fetch_gig_worker(worker_id)
881
+ logging.debug(f"Fetched gig worker: {result}")
882
+ return result
883
+
884
+ fetch_worker_button.click(handle_fetch_worker, inputs=fetch_worker_id, outputs=fetch_worker_output)
885
+
886
+ with gr.TabItem("Payment Management"):
887
+ gr.Markdown("Manage payments using Stripe.")
888
+
889
+ payment_amount = gr.Number(label="Amount")
890
+ payment_currency = gr.Textbox(label="Currency", value="usd")
891
+ payment_success_url = gr.Textbox(label="Success URL")
892
+ payment_cancel_url = gr.Textbox(label="Cancel URL")
893
+ create_payment_button = gr.Button(value="Create Payment Session")
894
+ payment_session_output = gr.Textbox(label="Payment Session URL")
895
+
896
+ def handle_create_payment_session(amount, currency, success_url, cancel_url):
897
+ logging.debug(f"Creating payment session for amount: {amount} {currency}")
898
+ result = create_payment_session(amount, currency, success_url, cancel_url)
899
+ logging.debug(f"Created payment session: {result}")
900
+ return result
901
+
902
+ create_payment_button.click(handle_create_payment_session, inputs=[payment_amount, payment_currency, payment_success_url, payment_cancel_url], outputs=payment_session_output)
903
+
904
+ iface.launch(server_name="0.0.0.0", server_port=int(os.getenv("PORT", 7860)), share=True)
905
+
906
+
907
+
908
+ if __name__ == "__main__":
909
+ gradio_interface()
insertGigWorkersIntoDB.py ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import csv
2
+ import psycopg2
3
+ import os
4
+ from dotenv import load_dotenv
5
+
6
+ # Load environment variables from .env file
7
+ load_dotenv()
8
+
9
+ # Get database connection
10
+ def get_database_connection():
11
+ database_url = os.getenv("DATABASE_URL")
12
+ if not database_url:
13
+ raise ValueError("DATABASE_URL is not set in environment variables.")
14
+ return psycopg2.connect(database_url)
15
+
16
+ # Verify data
17
+ def verify_data(row):
18
+ # Check if necessary fields are present
19
+ required_fields = ["Name", "About (description after screening)", "Skills (after screening)", "Rating", "Trust Score", "Ninja level(chunin ,join ,kage )", "Task Experience", "Online or not or schedule at this time each day"]
20
+ for field in required_fields:
21
+ if field not in row or not row[field]:
22
+ return False
23
+
24
+ # Check if rating and trust_score are within valid ranges
25
+ try:
26
+ rating = float(row["Rating"])
27
+ if rating < 0 or rating > 5:
28
+ return False
29
+ except ValueError:
30
+ return False
31
+
32
+ try:
33
+ trust_score = int(row["Trust Score"])
34
+ if trust_score < 0 or trust_score > 100:
35
+ return False
36
+ except ValueError:
37
+ return False
38
+
39
+ return True
40
+
41
+ # Insert data into database
42
+ def insert_data(row):
43
+ skills_array = row["Skills (after screening)"].split(",")
44
+ skills_array = [skill.strip() for skill in skills_array]
45
+ ninja_level = row["Ninja level(chunin ,join ,kage )"]
46
+
47
+ conn = get_database_connection()
48
+ try:
49
+ with conn.cursor() as curs:
50
+ curs.execute("""
51
+ INSERT INTO gig_workers (name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic)
52
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)
53
+ RETURNING id
54
+ """, (row["Name"], row["About (description after screening)"], skills_array, row["Rating"], row["Trust Score"], ninja_level, row["Task Experience"], row["Online or not or schedule at this time each day"], ''))
55
+ worker_id = curs.fetchone()[0]
56
+ conn.commit()
57
+ print(f"Gig worker added with ID: {worker_id}")
58
+ except Exception as e:
59
+ conn.rollback()
60
+ print(f"Error adding gig worker: {e}")
61
+ finally:
62
+ conn.close()
63
+
64
+ # Main function
65
+ def main():
66
+ file_path = '/Users/vishal/WORK/DATA_GEN/synthetic_profiles_1000.csv'
67
+
68
+ with open(file_path, newline='', encoding='utf-8') as csvfile:
69
+ reader = csv.DictReader(csvfile)
70
+ for row in reader:
71
+ if verify_data(row):
72
+ insert_data(row)
73
+ else:
74
+ print(f"Invalid data: {row}")
75
+
76
+ if __name__ == "__main__":
77
+ main()
insertUsersIntoDB.py ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import psycopg2
2
+ import json
3
+ from faker import Faker
4
+ import os
5
+ from dotenv import load_dotenv
6
+
7
+ # Load environment variables from .env file
8
+ load_dotenv()
9
+
10
+ # Set up Faker for generating fake user data
11
+ fake = Faker()
12
+
13
+ # Get database connection
14
+ def get_database_connection():
15
+ database_url = os.getenv("DATABASE_URL")
16
+ if not database_url:
17
+ raise ValueError("DATABASE_URL is not set in environment variables.")
18
+ return psycopg2.connect(database_url)
19
+
20
+ # Function to insert a single user into the database
21
+ def insert_user(name, profile_name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic, is_pro):
22
+ skills_json = json.dumps(skills)
23
+
24
+ conn = get_database_connection()
25
+ try:
26
+ with conn.cursor() as curs:
27
+ curs.execute("""
28
+ INSERT INTO users (name, profile_name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic, is_pro)
29
+ VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)
30
+ RETURNING user_id
31
+ """, (name, profile_name, about, skills_json, rating, trust_score, ninja_level, task_experience, online_status, profile_pic, is_pro))
32
+ user_id = curs.fetchone()[0]
33
+ conn.commit()
34
+ print(f"User added with ID: {user_id}")
35
+ except Exception as e:
36
+ conn.rollback()
37
+ print(f"Error adding user: {e}")
38
+ finally:
39
+ conn.close()
40
+
41
+ # Function to generate and insert 5 unique users
42
+ def insert_unique_users():
43
+ for _ in range(5):
44
+ name = fake.name()
45
+ profile_name = fake.user_name()
46
+ about = fake.text()
47
+ skills = [fake.job() for _ in range(5)]
48
+ rating = round(min(fake.random.uniform(0, 5.00), 5.00), 2) # Ensure rating is within 0.00 to 5.00
49
+ trust_score = round(min(fake.random.uniform(0, 5.00), 5.00), 2) # Ensure trust_score is within 0.00 to 5.00
50
+ ninja_level = fake.random.randint(1, 10)
51
+ task_experience = fake.random.randint(0, 1000)
52
+ online_status = fake.boolean()
53
+ profile_pic = fake.image_url()
54
+ is_pro = fake.boolean()
55
+
56
+ insert_user(name, profile_name, about, skills, rating, trust_score, ninja_level, task_experience, online_status, profile_pic, is_pro)
57
+
58
+ if __name__ == "__main__":
59
+ insert_unique_users()
requirements.txt ADDED
@@ -0,0 +1,113 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ flask>=2.0.3
2
+ python-dotenv>=0.19.2
3
+ authlib>=1.0
4
+ requests>=2.27.1
5
+ aiofiles==23.2.1
6
+ aiohttp==3.9.5
7
+ aiosignal==1.3.1
8
+ alpha-vantage==2.3.1
9
+ altair==5.3.0
10
+ annotated-types==0.6.0
11
+ anyio==4.3.0
12
+ attrs==23.2.0
13
+ beautifulsoup4==4.12.3
14
+ cachetools==5.3.3
15
+ certifi==2024.2.2
16
+ charset-normalizer==3.3.2
17
+ click==8.1.7
18
+ cloudscraper==1.2.71
19
+ contourpy==1.2.1
20
+ cycler==0.12.1
21
+ dnspython==2.6.1
22
+ email_validator==2.1.1
23
+ Faker==25.2.0
24
+ fastapi==0.111.0
25
+ fastapi-cli==0.0.3
26
+ ffmpy==0.3.2
27
+ filelock==3.14.0
28
+ fonttools==4.51.0
29
+ frozenlist==1.4.1
30
+ fsspec==2024.3.1
31
+ google-ai-generativelanguage==0.6.3
32
+ google-api-core==2.19.0
33
+ google-api-python-client==2.129.0
34
+ google-auth==2.29.0
35
+ google-auth-httplib2==0.2.0
36
+ google-generativeai==0.5.3
37
+ googleapis-common-protos==1.63.0
38
+ gradio==4.31.2
39
+ gradio_client==0.16.3
40
+ grpcio==1.63.0
41
+ grpcio-status==1.62.2
42
+ h11==0.14.0
43
+ httpcore==1.0.5
44
+ httplib2==0.22.0
45
+ httptools==0.6.1
46
+ httpx==0.27.0
47
+ huggingface-hub==0.23.0
48
+ idna==3.7
49
+ importlib_resources==6.4.0
50
+ Jinja2==3.1.4
51
+ jsonschema==4.22.0
52
+ jsonschema-specifications==2023.12.1
53
+ kiwisolver==1.4.5
54
+ markdown-it-py==3.0.0
55
+ MarkupSafe==2.1.5
56
+ matplotlib==3.8.4
57
+ mdurl==0.1.2
58
+ multidict==6.0.5
59
+ numpy==1.26.4
60
+ oauthlib==3.2.2
61
+ orjson==3.10.3
62
+ packaging==24.0
63
+ pandas==2.2.2
64
+ pillow==10.3.0
65
+ praw==7.7.1
66
+ prawcore==2.4.0
67
+ proto-plus==1.23.0
68
+ protobuf==4.25.3
69
+ psycopg2==2.9.9
70
+ pyasn1==0.6.0
71
+ pyasn1_modules==0.4.0
72
+ pydantic==2.7.1
73
+ pydantic_core==2.18.2
74
+ pydub==0.25.1
75
+ Pygments==2.18.0
76
+ pyparsing==3.1.2
77
+ python-dateutil==2.9.0.post0
78
+ python-dotenv==1.0.1
79
+ python-multipart==0.0.9
80
+ pytz==2024.1
81
+ PyYAML==6.0.1
82
+ referencing==0.35.1
83
+ requests==2.31.0
84
+ requests-oauthlib==1.3.1
85
+ requests-toolbelt==1.0.0
86
+ rich==13.7.1
87
+ rpds-py==0.18.1
88
+ rsa==4.9
89
+ ruff==0.4.4
90
+ semantic-version==2.10.0
91
+ shellingham==1.5.4
92
+ six==1.16.0
93
+ sniffio==1.3.1
94
+ soupsieve==2.5
95
+ starlette==0.37.2
96
+ stripe==9.8.0
97
+ tomlkit==0.12.0
98
+ toolz==0.12.1
99
+ tqdm==4.66.4
100
+ tweepy==4.14.0
101
+ typer==0.12.3
102
+ typing_extensions==4.11.0
103
+ tzdata==2024.1
104
+ ujson==5.10.0
105
+ update-checker==0.18.0
106
+ uritemplate==4.1.1
107
+ urllib3==2.2.1
108
+ uvicorn==0.29.0
109
+ uvloop==0.19.0
110
+ watchfiles==0.21.0
111
+ websocket-client==1.8.0
112
+ websockets==11.0.3
113
+ yarl==1.9.4
venv/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ # created by virtualenv automatically
2
+ *
venv/bin/activate ADDED
@@ -0,0 +1,87 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate" *from bash*
2
+ # you cannot run it directly
3
+
4
+
5
+ if [ "${BASH_SOURCE-}" = "$0" ]; then
6
+ echo "You must source this script: \$ source $0" >&2
7
+ exit 33
8
+ fi
9
+
10
+ deactivate () {
11
+ unset -f pydoc >/dev/null 2>&1 || true
12
+
13
+ # reset old environment variables
14
+ # ! [ -z ${VAR+_} ] returns true if VAR is declared at all
15
+ if ! [ -z "${_OLD_VIRTUAL_PATH:+_}" ] ; then
16
+ PATH="$_OLD_VIRTUAL_PATH"
17
+ export PATH
18
+ unset _OLD_VIRTUAL_PATH
19
+ fi
20
+ if ! [ -z "${_OLD_VIRTUAL_PYTHONHOME+_}" ] ; then
21
+ PYTHONHOME="$_OLD_VIRTUAL_PYTHONHOME"
22
+ export PYTHONHOME
23
+ unset _OLD_VIRTUAL_PYTHONHOME
24
+ fi
25
+
26
+ # The hash command must be called to get it to forget past
27
+ # commands. Without forgetting past commands the $PATH changes
28
+ # we made may not be respected
29
+ hash -r 2>/dev/null
30
+
31
+ if ! [ -z "${_OLD_VIRTUAL_PS1+_}" ] ; then
32
+ PS1="$_OLD_VIRTUAL_PS1"
33
+ export PS1
34
+ unset _OLD_VIRTUAL_PS1
35
+ fi
36
+
37
+ unset VIRTUAL_ENV
38
+ unset VIRTUAL_ENV_PROMPT
39
+ if [ ! "${1-}" = "nondestructive" ] ; then
40
+ # Self destruct!
41
+ unset -f deactivate
42
+ fi
43
+ }
44
+
45
+ # unset irrelevant variables
46
+ deactivate nondestructive
47
+
48
+ VIRTUAL_ENV='/Users/vishal/WORK/TaskNinja/venv'
49
+ if ([ "$OSTYPE" = "cygwin" ] || [ "$OSTYPE" = "msys" ]) && $(command -v cygpath &> /dev/null) ; then
50
+ VIRTUAL_ENV=$(cygpath -u "$VIRTUAL_ENV")
51
+ fi
52
+ export VIRTUAL_ENV
53
+
54
+ _OLD_VIRTUAL_PATH="$PATH"
55
+ PATH="$VIRTUAL_ENV/bin:$PATH"
56
+ export PATH
57
+
58
+ if [ "x" != x ] ; then
59
+ VIRTUAL_ENV_PROMPT=""
60
+ else
61
+ VIRTUAL_ENV_PROMPT=$(basename "$VIRTUAL_ENV")
62
+ fi
63
+ export VIRTUAL_ENV_PROMPT
64
+
65
+ # unset PYTHONHOME if set
66
+ if ! [ -z "${PYTHONHOME+_}" ] ; then
67
+ _OLD_VIRTUAL_PYTHONHOME="$PYTHONHOME"
68
+ unset PYTHONHOME
69
+ fi
70
+
71
+ if [ -z "${VIRTUAL_ENV_DISABLE_PROMPT-}" ] ; then
72
+ _OLD_VIRTUAL_PS1="${PS1-}"
73
+ PS1="(${VIRTUAL_ENV_PROMPT}) ${PS1-}"
74
+ export PS1
75
+ fi
76
+
77
+ # Make sure to unalias pydoc if it's already there
78
+ alias pydoc 2>/dev/null >/dev/null && unalias pydoc || true
79
+
80
+ pydoc () {
81
+ python -m pydoc "$@"
82
+ }
83
+
84
+ # The hash command must be called to get it to forget past
85
+ # commands. Without forgetting past commands the $PATH changes
86
+ # we made may not be respected
87
+ hash -r 2>/dev/null || true
venv/bin/activate.csh ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used with "source bin/activate.csh" *from csh*.
2
+ # You cannot run it directly.
3
+ # Created by Davide Di Blasi <davidedb@gmail.com>.
4
+
5
+ set newline='\
6
+ '
7
+
8
+ alias deactivate 'test $?_OLD_VIRTUAL_PATH != 0 && setenv PATH "$_OLD_VIRTUAL_PATH:q" && unset _OLD_VIRTUAL_PATH; rehash; test $?_OLD_VIRTUAL_PROMPT != 0 && set prompt="$_OLD_VIRTUAL_PROMPT:q" && unset _OLD_VIRTUAL_PROMPT; unsetenv VIRTUAL_ENV; unsetenv VIRTUAL_ENV_PROMPT; test "\!:*" != "nondestructive" && unalias deactivate && unalias pydoc'
9
+
10
+ # Unset irrelevant variables.
11
+ deactivate nondestructive
12
+
13
+ setenv VIRTUAL_ENV '/Users/vishal/WORK/TaskNinja/venv'
14
+
15
+ set _OLD_VIRTUAL_PATH="$PATH:q"
16
+ setenv PATH "$VIRTUAL_ENV:q/bin:$PATH:q"
17
+
18
+
19
+
20
+ if ('' != "") then
21
+ setenv VIRTUAL_ENV_PROMPT ''
22
+ else
23
+ setenv VIRTUAL_ENV_PROMPT "$VIRTUAL_ENV:t:q"
24
+ endif
25
+
26
+ if ( $?VIRTUAL_ENV_DISABLE_PROMPT ) then
27
+ if ( $VIRTUAL_ENV_DISABLE_PROMPT == "" ) then
28
+ set do_prompt = "1"
29
+ else
30
+ set do_prompt = "0"
31
+ endif
32
+ else
33
+ set do_prompt = "1"
34
+ endif
35
+
36
+ if ( $do_prompt == "1" ) then
37
+ # Could be in a non-interactive environment,
38
+ # in which case, $prompt is undefined and we wouldn't
39
+ # care about the prompt anyway.
40
+ if ( $?prompt ) then
41
+ set _OLD_VIRTUAL_PROMPT="$prompt:q"
42
+ if ( "$prompt:q" =~ *"$newline:q"* ) then
43
+ :
44
+ else
45
+ set prompt = '('"$VIRTUAL_ENV_PROMPT:q"') '"$prompt:q"
46
+ endif
47
+ endif
48
+ endif
49
+
50
+ unset env_name
51
+ unset do_prompt
52
+
53
+ alias pydoc python -m pydoc
54
+
55
+ rehash
venv/bin/activate.fish ADDED
@@ -0,0 +1,103 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file must be used using `source bin/activate.fish` *within a running fish ( http://fishshell.com ) session*.
2
+ # Do not run it directly.
3
+
4
+ function _bashify_path -d "Converts a fish path to something bash can recognize"
5
+ set fishy_path $argv
6
+ set bashy_path $fishy_path[1]
7
+ for path_part in $fishy_path[2..-1]
8
+ set bashy_path "$bashy_path:$path_part"
9
+ end
10
+ echo $bashy_path
11
+ end
12
+
13
+ function _fishify_path -d "Converts a bash path to something fish can recognize"
14
+ echo $argv | tr ':' '\n'
15
+ end
16
+
17
+ function deactivate -d 'Exit virtualenv mode and return to the normal environment.'
18
+ # reset old environment variables
19
+ if test -n "$_OLD_VIRTUAL_PATH"
20
+ # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
21
+ if test (echo $FISH_VERSION | head -c 1) -lt 3
22
+ set -gx PATH (_fishify_path "$_OLD_VIRTUAL_PATH")
23
+ else
24
+ set -gx PATH $_OLD_VIRTUAL_PATH
25
+ end
26
+ set -e _OLD_VIRTUAL_PATH
27
+ end
28
+
29
+ if test -n "$_OLD_VIRTUAL_PYTHONHOME"
30
+ set -gx PYTHONHOME "$_OLD_VIRTUAL_PYTHONHOME"
31
+ set -e _OLD_VIRTUAL_PYTHONHOME
32
+ end
33
+
34
+ if test -n "$_OLD_FISH_PROMPT_OVERRIDE"
35
+ and functions -q _old_fish_prompt
36
+ # Set an empty local `$fish_function_path` to allow the removal of `fish_prompt` using `functions -e`.
37
+ set -l fish_function_path
38
+
39
+ # Erase virtualenv's `fish_prompt` and restore the original.
40
+ functions -e fish_prompt
41
+ functions -c _old_fish_prompt fish_prompt
42
+ functions -e _old_fish_prompt
43
+ set -e _OLD_FISH_PROMPT_OVERRIDE
44
+ end
45
+
46
+ set -e VIRTUAL_ENV
47
+ set -e VIRTUAL_ENV_PROMPT
48
+
49
+ if test "$argv[1]" != 'nondestructive'
50
+ # Self-destruct!
51
+ functions -e pydoc
52
+ functions -e deactivate
53
+ functions -e _bashify_path
54
+ functions -e _fishify_path
55
+ end
56
+ end
57
+
58
+ # Unset irrelevant variables.
59
+ deactivate nondestructive
60
+
61
+ set -gx VIRTUAL_ENV '/Users/vishal/WORK/TaskNinja/venv'
62
+
63
+ # https://github.com/fish-shell/fish-shell/issues/436 altered PATH handling
64
+ if test (echo $FISH_VERSION | head -c 1) -lt 3
65
+ set -gx _OLD_VIRTUAL_PATH (_bashify_path $PATH)
66
+ else
67
+ set -gx _OLD_VIRTUAL_PATH $PATH
68
+ end
69
+ set -gx PATH "$VIRTUAL_ENV"'/bin' $PATH
70
+
71
+ # Prompt override provided?
72
+ # If not, just use the environment name.
73
+ if test -n ''
74
+ set -gx VIRTUAL_ENV_PROMPT ''
75
+ else
76
+ set -gx VIRTUAL_ENV_PROMPT (basename "$VIRTUAL_ENV")
77
+ end
78
+
79
+ # Unset `$PYTHONHOME` if set.
80
+ if set -q PYTHONHOME
81
+ set -gx _OLD_VIRTUAL_PYTHONHOME $PYTHONHOME
82
+ set -e PYTHONHOME
83
+ end
84
+
85
+ function pydoc
86
+ python -m pydoc $argv
87
+ end
88
+
89
+ if test -z "$VIRTUAL_ENV_DISABLE_PROMPT"
90
+ # Copy the current `fish_prompt` function as `_old_fish_prompt`.
91
+ functions -c fish_prompt _old_fish_prompt
92
+
93
+ function fish_prompt
94
+ # Run the user's prompt first; it might depend on (pipe)status.
95
+ set -l prompt (_old_fish_prompt)
96
+
97
+ printf '(%s) ' $VIRTUAL_ENV_PROMPT
98
+
99
+ string join -- \n $prompt # handle multi-line prompts
100
+ end
101
+
102
+ set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
103
+ end
venv/bin/activate.nu ADDED
@@ -0,0 +1,96 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # virtualenv activation module
2
+ # Activate with `overlay use activate.nu`
3
+ # Deactivate with `deactivate`, as usual
4
+ #
5
+ # To customize the overlay name, you can call `overlay use activate.nu as foo`,
6
+ # but then simply `deactivate` won't work because it is just an alias to hide
7
+ # the "activate" overlay. You'd need to call `overlay hide foo` manually.
8
+
9
+ export-env {
10
+ def is-string [x] {
11
+ ($x | describe) == 'string'
12
+ }
13
+
14
+ def has-env [...names] {
15
+ $names | each {|n|
16
+ $n in $env
17
+ } | all {|i| $i == true}
18
+ }
19
+
20
+ # Emulates a `test -z`, but btter as it handles e.g 'false'
21
+ def is-env-true [name: string] {
22
+ if (has-env $name) {
23
+ # Try to parse 'true', '0', '1', and fail if not convertible
24
+ let parsed = (do -i { $env | get $name | into bool })
25
+ if ($parsed | describe) == 'bool' {
26
+ $parsed
27
+ } else {
28
+ not ($env | get -i $name | is-empty)
29
+ }
30
+ } else {
31
+ false
32
+ }
33
+ }
34
+
35
+ let virtual_env = '/Users/vishal/WORK/TaskNinja/venv'
36
+ let bin = 'bin'
37
+
38
+ let is_windows = ($nu.os-info.family) == 'windows'
39
+ let path_name = (if (has-env 'Path') {
40
+ 'Path'
41
+ } else {
42
+ 'PATH'
43
+ }
44
+ )
45
+
46
+ let venv_path = ([$virtual_env $bin] | path join)
47
+ let new_path = ($env | get $path_name | prepend $venv_path)
48
+
49
+ # If there is no default prompt, then use the env name instead
50
+ let virtual_env_prompt = (if ('' | is-empty) {
51
+ ($virtual_env | path basename)
52
+ } else {
53
+ ''
54
+ })
55
+
56
+ let new_env = {
57
+ $path_name : $new_path
58
+ VIRTUAL_ENV : $virtual_env
59
+ VIRTUAL_ENV_PROMPT : $virtual_env_prompt
60
+ }
61
+
62
+ let new_env = (if (is-env-true 'VIRTUAL_ENV_DISABLE_PROMPT') {
63
+ $new_env
64
+ } else {
65
+ # Creating the new prompt for the session
66
+ let virtual_prefix = $'(char lparen)($virtual_env_prompt)(char rparen) '
67
+
68
+ # Back up the old prompt builder
69
+ let old_prompt_command = (if (has-env 'PROMPT_COMMAND') {
70
+ $env.PROMPT_COMMAND
71
+ } else {
72
+ ''
73
+ })
74
+
75
+ let new_prompt = (if (has-env 'PROMPT_COMMAND') {
76
+ if 'closure' in ($old_prompt_command | describe) {
77
+ {|| $'($virtual_prefix)(do $old_prompt_command)' }
78
+ } else {
79
+ {|| $'($virtual_prefix)($old_prompt_command)' }
80
+ }
81
+ } else {
82
+ {|| $'($virtual_prefix)' }
83
+ })
84
+
85
+ $new_env | merge {
86
+ PROMPT_COMMAND : $new_prompt
87
+ VIRTUAL_PREFIX : $virtual_prefix
88
+ }
89
+ })
90
+
91
+ # Environment variables that will be loaded as the virtual env
92
+ load-env $new_env
93
+ }
94
+
95
+ export alias pydoc = python -m pydoc
96
+ export alias deactivate = overlay hide activate
venv/bin/activate.ps1 ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ $script:THIS_PATH = $myinvocation.mycommand.path
2
+ $script:BASE_DIR = Split-Path (Resolve-Path "$THIS_PATH/..") -Parent
3
+
4
+ function global:deactivate([switch] $NonDestructive) {
5
+ if (Test-Path variable:_OLD_VIRTUAL_PATH) {
6
+ $env:PATH = $variable:_OLD_VIRTUAL_PATH
7
+ Remove-Variable "_OLD_VIRTUAL_PATH" -Scope global
8
+ }
9
+
10
+ if (Test-Path function:_old_virtual_prompt) {
11
+ $function:prompt = $function:_old_virtual_prompt
12
+ Remove-Item function:\_old_virtual_prompt
13
+ }
14
+
15
+ if ($env:VIRTUAL_ENV) {
16
+ Remove-Item env:VIRTUAL_ENV -ErrorAction SilentlyContinue
17
+ }
18
+
19
+ if ($env:VIRTUAL_ENV_PROMPT) {
20
+ Remove-Item env:VIRTUAL_ENV_PROMPT -ErrorAction SilentlyContinue
21
+ }
22
+
23
+ if (!$NonDestructive) {
24
+ # Self destruct!
25
+ Remove-Item function:deactivate
26
+ Remove-Item function:pydoc
27
+ }
28
+ }
29
+
30
+ function global:pydoc {
31
+ python -m pydoc $args
32
+ }
33
+
34
+ # unset irrelevant variables
35
+ deactivate -nondestructive
36
+
37
+ $VIRTUAL_ENV = $BASE_DIR
38
+ $env:VIRTUAL_ENV = $VIRTUAL_ENV
39
+
40
+ if ("" -ne "") {
41
+ $env:VIRTUAL_ENV_PROMPT = ""
42
+ }
43
+ else {
44
+ $env:VIRTUAL_ENV_PROMPT = $( Split-Path $env:VIRTUAL_ENV -Leaf )
45
+ }
46
+
47
+ New-Variable -Scope global -Name _OLD_VIRTUAL_PATH -Value $env:PATH
48
+
49
+ $env:PATH = "$env:VIRTUAL_ENV/bin:" + $env:PATH
50
+ if (!$env:VIRTUAL_ENV_DISABLE_PROMPT) {
51
+ function global:_old_virtual_prompt {
52
+ ""
53
+ }
54
+ $function:_old_virtual_prompt = $function:prompt
55
+
56
+ function global:prompt {
57
+ # Add the custom prefix to the existing prompt
58
+ $previous_prompt_value = & $function:_old_virtual_prompt
59
+ ("(" + $env:VIRTUAL_ENV_PROMPT + ") " + $previous_prompt_value)
60
+ }
61
+ }
venv/bin/activate_this.py ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Activate virtualenv for current interpreter:
3
+
4
+ import runpy
5
+ runpy.run_path(this_file)
6
+
7
+ This can be used when you must use an existing Python interpreter, not the virtualenv bin/python.
8
+ """ # noqa: D415
9
+
10
+ from __future__ import annotations
11
+
12
+ import os
13
+ import site
14
+ import sys
15
+
16
+ try:
17
+ abs_file = os.path.abspath(__file__)
18
+ except NameError as exc:
19
+ msg = "You must use import runpy; runpy.run_path(this_file)"
20
+ raise AssertionError(msg) from exc
21
+
22
+ bin_dir = os.path.dirname(abs_file)
23
+ base = bin_dir[: -len("bin") - 1] # strip away the bin part from the __file__, plus the path separator
24
+
25
+ # prepend bin to PATH (this file is inside the bin directory)
26
+ os.environ["PATH"] = os.pathsep.join([bin_dir, *os.environ.get("PATH", "").split(os.pathsep)])
27
+ os.environ["VIRTUAL_ENV"] = base # virtual env is right above bin directory
28
+ os.environ["VIRTUAL_ENV_PROMPT"] = "" or os.path.basename(base) # noqa: SIM222
29
+
30
+ # add the virtual environments libraries to the host python import mechanism
31
+ prev_length = len(sys.path)
32
+ for lib in "../lib/python3.11/site-packages".split(os.pathsep):
33
+ path = os.path.realpath(os.path.join(bin_dir, lib))
34
+ site.addsitedir(path.decode("utf-8") if "" else path)
35
+ sys.path[:] = sys.path[prev_length:] + sys.path[0:prev_length]
36
+
37
+ sys.real_prefix = sys.prefix
38
+ sys.prefix = base
venv/bin/dotenv ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from dotenv.__main__ import cli
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(cli())
venv/bin/email_validator ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from email_validator.__main__ import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/f2py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from numpy.f2py.f2py2e import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/faker ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from faker.cli import execute_from_command_line
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(execute_from_command_line())
venv/bin/fastapi ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from fastapi_cli.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/flask ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from flask.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/fonttools ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from fontTools.__main__ import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/gradio ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from gradio.cli import cli
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(cli())
venv/bin/httpx ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from httpx import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/huggingface-cli ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from huggingface_hub.commands.huggingface_cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/jsonschema ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from jsonschema.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/markdown-it ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from markdown_it.cli.parse import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/normalizer ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from charset_normalizer.cli import cli_detect
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(cli_detect())
venv/bin/pip ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/pip-3.11 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/pip3 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/pip3.11 ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pip._internal.cli.main import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/pyftmerge ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from fontTools.merge import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/pyftsubset ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from fontTools.subset import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/pygmentize ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from pygments.cmdline import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/pyrsa-decrypt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from rsa.cli import decrypt
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(decrypt())
venv/bin/pyrsa-encrypt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from rsa.cli import encrypt
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(encrypt())
venv/bin/pyrsa-keygen ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from rsa.cli import keygen
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(keygen())
venv/bin/pyrsa-priv2pub ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from rsa.util import private_to_public
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(private_to_public())
venv/bin/pyrsa-sign ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from rsa.cli import sign
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(sign())
venv/bin/pyrsa-verify ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from rsa.cli import verify
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(verify())
venv/bin/python ADDED
Binary file (52.6 kB). View file
 
venv/bin/python3 ADDED
Binary file (52.6 kB). View file
 
venv/bin/python3.11 ADDED
Binary file (52.6 kB). View file
 
venv/bin/ruff ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0418410f0c2c9314889ad14a316767c79400faffeddcff17522d094503d06c76
3
+ size 20584232
venv/bin/streamlit ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from streamlit.web.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/streamlit.cmd ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ rem Copyright (c) Streamlit Inc. (2018-2022) Snowflake Inc. (2022-2024)
2
+ rem
3
+ rem Licensed under the Apache License, Version 2.0 (the "License");
4
+ rem you may not use this file except in compliance with the License.
5
+ rem You may obtain a copy of the License at
6
+ rem
7
+ rem http://www.apache.org/licenses/LICENSE-2.0
8
+ rem
9
+ rem Unless required by applicable law or agreed to in writing, software
10
+ rem distributed under the License is distributed on an "AS IS" BASIS,
11
+ rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ rem See the License for the specific language governing permissions and
13
+ rem limitations under the License.
14
+
15
+ @echo OFF
16
+ python -m streamlit %*
venv/bin/tqdm ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from tqdm.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/ttx ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from fontTools.ttx import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())
venv/bin/typer ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #!/Users/vishal/WORK/TaskNinja/venv/bin/python
2
+ # -*- coding: utf-8 -*-
3
+ import re
4
+ import sys
5
+ from typer.cli import main
6
+ if __name__ == '__main__':
7
+ sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
8
+ sys.exit(main())