Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,5 @@
|
|
1 |
import gradio as gr
|
2 |
from sentence_transformers import SentenceTransformer, util
|
3 |
-
from PIL import Image
|
4 |
import openai
|
5 |
import os
|
6 |
|
@@ -95,25 +94,6 @@ def query_model(question):
|
|
95 |
return "Could not find specific information. Please refine your question."
|
96 |
response = generate_response(question, relevant_segment)
|
97 |
return response
|
98 |
-
|
99 |
-
|
100 |
-
# Path to the image
|
101 |
-
image_path = "composting.jpg"
|
102 |
-
resized_image_path = "composting_resized.jpg"
|
103 |
-
|
104 |
-
# Check if the image file exists
|
105 |
-
if os.path.exists(image_path):
|
106 |
-
# Open and resize the image
|
107 |
-
with Image.open(image_path) as img:
|
108 |
-
# Define the new size (e.g., reducing size by 50%)
|
109 |
-
new_size = (int(img.size[0] * 0.5), int(img.size[1] * 0.5))
|
110 |
-
# Resize the image
|
111 |
-
resized_img = img.resize(new_size, Image.ANTIALIAS)
|
112 |
-
# Save the resized image
|
113 |
-
resized_img.save(resized_image_path)
|
114 |
-
else:
|
115 |
-
print(f"Error: The image file '{image_path}' was not found.")
|
116 |
-
exit(1)
|
117 |
|
118 |
# Define the welcome message and specific topics the chatbot can provide information about
|
119 |
welcome_message = """
|
|
|
1 |
import gradio as gr
|
2 |
from sentence_transformers import SentenceTransformer, util
|
|
|
3 |
import openai
|
4 |
import os
|
5 |
|
|
|
94 |
return "Could not find specific information. Please refine your 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 = """
|