RatanPrakash commited on
Commit
2efa4a4
·
1 Parent(s): 29f2eec

Update team member images and refactor progress simulation function

Browse files
app.py CHANGED
@@ -119,9 +119,9 @@ ocr = PaddleOCR(use_angle_cls=True, lang='en')
119
  # Team details
120
  team_members = [
121
  {"name": "Aman Deep", "image": "aman.jpg"}, # Replace with actual paths to images
122
- {"name": "Nandini", "image": "myimage.jpg"},
123
- {"name": "Abhay Sharma", "image": "gaurav.jpg"},
124
- {"name": "Ratan Prakash Mishra", "image": "anandimg.jpg"}
125
  ]
126
 
127
  # Function to preprocess the images for the model
@@ -160,10 +160,6 @@ def preprocess_image(image):
160
  print(f"Error processing image: {e}")
161
  return None # Return None if there's an error
162
 
163
- # Function to check if a file exists
164
- def file_exists(file_path):
165
- return os.path.isfile(file_path)
166
-
167
  # Function to display circular images in a matrix format
168
  def display_images_in_grid(images, max_images_per_row=4):
169
  num_images = len(images)
@@ -190,6 +186,13 @@ def display_team_members(members, max_members_per_row=4):
190
  st.image(circular_img, use_column_width=True) # Display the circular image
191
  st.write(member["name"]) # Display the name below the image
192
 
 
 
 
 
 
 
 
193
  # Title and description
194
  st.title("Amazon Smbhav")
195
  # Team Details with links
@@ -309,7 +312,6 @@ elif app_mode == "Task 1":
309
 
310
  if post_url:
311
  caption, imageArray = get_instagram_post_details(post_url)
312
-
313
  if caption or imageArray.shape[0] > 0:
314
  st.subheader("Caption:")
315
  st.write(caption)
@@ -330,6 +332,7 @@ elif app_mode == "Task 1":
330
  message = f"image ocr: {text} Caption: {caption}"
331
  st.write(message)
332
  #OCR result text to be parsed here through LLM and get product listing content.
 
333
  messages.append({"role": "user", "content": message})
334
  completion = client.chat.completions.create(
335
  model="meta-llama/Llama-3.2-3B-Instruct",
@@ -357,14 +360,6 @@ elif app_mode == "Task 1":
357
  # Display the circular images in a matrix/grid format
358
  display_images_in_grid(circular_images, max_images_per_row=4)
359
 
360
- # Function to simulate loading process with a progress bar
361
- def simulate_progress():
362
- progress_bar = st.progress(0)
363
- for percent_complete in range(100):
364
- time.sleep(0.02)
365
- progress_bar.progress(percent_complete + 1)
366
- # Function to remove gibberish using regex (removes non-alphanumeric chars, filters out very short text)
367
-
368
  if st.button("Start Analysis"):
369
  simulate_progress()
370
  # Loop through each uploaded image and process them
@@ -387,6 +382,7 @@ elif app_mode == "Task 1":
387
  text += currText + " "
388
  st.write(f"OCR Result: {text}")
389
  #OCR result text to be parsed here through LLM and get product listing content.
 
390
  messages.append({"role": "user", "content": text})
391
  completion = client.chat.completions.create(
392
  model="meta-llama/Llama-3.2-3B-Instruct",
 
119
  # Team details
120
  team_members = [
121
  {"name": "Aman Deep", "image": "aman.jpg"}, # Replace with actual paths to images
122
+ {"name": "Nandini", "image": "nandini.jpg"},
123
+ {"name": "Abhay Sharma", "image": "abhay.jpg"},
124
+ {"name": "Ratan Prakash Mishra", "image": "ratan.jpg"}
125
  ]
126
 
127
  # Function to preprocess the images for the model
 
160
  print(f"Error processing image: {e}")
161
  return None # Return None if there's an error
162
 
 
 
 
 
163
  # Function to display circular images in a matrix format
164
  def display_images_in_grid(images, max_images_per_row=4):
165
  num_images = len(images)
 
186
  st.image(circular_img, use_column_width=True) # Display the circular image
187
  st.write(member["name"]) # Display the name below the image
188
 
189
+ # Function to simulate loading process with a progress bar
190
+ def simulate_progress():
191
+ progress_bar = st.progress(0)
192
+ for percent_complete in range(100):
193
+ time.sleep(0.02)
194
+ progress_bar.progress(percent_complete + 1)
195
+
196
  # Title and description
197
  st.title("Amazon Smbhav")
198
  # Team Details with links
 
312
 
313
  if post_url:
314
  caption, imageArray = get_instagram_post_details(post_url)
 
315
  if caption or imageArray.shape[0] > 0:
316
  st.subheader("Caption:")
317
  st.write(caption)
 
332
  message = f"image ocr: {text} Caption: {caption}"
333
  st.write(message)
334
  #OCR result text to be parsed here through LLM and get product listing content.
335
+ simulate_progress()
336
  messages.append({"role": "user", "content": message})
337
  completion = client.chat.completions.create(
338
  model="meta-llama/Llama-3.2-3B-Instruct",
 
360
  # Display the circular images in a matrix/grid format
361
  display_images_in_grid(circular_images, max_images_per_row=4)
362
 
 
 
 
 
 
 
 
 
363
  if st.button("Start Analysis"):
364
  simulate_progress()
365
  # Loop through each uploaded image and process them
 
382
  text += currText + " "
383
  st.write(f"OCR Result: {text}")
384
  #OCR result text to be parsed here through LLM and get product listing content.
385
+ simulate_progress()
386
  messages.append({"role": "user", "content": text})
387
  completion = client.chat.completions.create(
388
  model="meta-llama/Llama-3.2-3B-Instruct",
myimage.jpg → nandini.jpg RENAMED
File without changes
anandimg.jpg → ratan.jpg RENAMED
File without changes