dogutcu commited on
Commit
02e8cce
·
verified ·
1 Parent(s): ebb980a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -0
app.py CHANGED
@@ -1,5 +1,6 @@
1
  import gradio as gr
2
  from sentence_transformers import SentenceTransformer, util
 
3
  import openai
4
  import os
5
 
@@ -95,6 +96,22 @@ def query_model(question):
95
  response = generate_response(question, relevant_segment)
96
  return response
97
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  # Define the welcome message and specific topics the chatbot can provide information about
99
  welcome_message = """
100
  # 🌱Welcome to CompBot!
 
1
  import gradio as gr
2
  from sentence_transformers import SentenceTransformer, util
3
+ from PIL import Image
4
  import openai
5
  import os
6
 
 
96
  response = generate_response(question, relevant_segment)
97
  return response
98
 
99
+ with Image.open("composting.jpg") as img:
100
+ # Print the current size of the image
101
+ print("Original size:", img.size)
102
+
103
+ # Define the new size
104
+ new_size = (int(img.size[0] * 0.5), int(img.size[1] * 0.5)) # for example, reducing size by 50%
105
+
106
+ # Resize the image
107
+ resized_img = img.resize(new_size, Image.ANTIALIAS)
108
+
109
+ # Print the new size of the image
110
+ print("Resized size:", resized_img.size)
111
+
112
+ # Save the resized image
113
+ resized_img.save("composting_resized.jpg")
114
+
115
  # Define the welcome message and specific topics the chatbot can provide information about
116
  welcome_message = """
117
  # 🌱Welcome to CompBot!