Update app.py
Browse files
app.py
CHANGED
@@ -12,8 +12,8 @@ processor = AutoImageProcessor.from_pretrained(model_name)
|
|
12 |
model = AutoModelForImageClassification.from_pretrained(model_name)
|
13 |
|
14 |
# Set your OpenAI API key from environment variable
|
15 |
-
openai_api_key = os.getenv("
|
16 |
-
openai.api_key
|
17 |
|
18 |
# Dropdown Options
|
19 |
car_companies = ["Select", "Toyota", "Honda", "Ford", "BMW", "Mercedes", "Audi", "Hyundai", "Kia", "Nissan"]
|
@@ -41,7 +41,7 @@ def estimate_repair_cost(damage_type, company, model, year, country):
|
|
41 |
)
|
42 |
|
43 |
try:
|
44 |
-
response =
|
45 |
model="gpt-4o-mini",
|
46 |
messages=[
|
47 |
{"role": "system", "content": "You are an expert in car repair cost estimation."},
|
|
|
12 |
model = AutoModelForImageClassification.from_pretrained(model_name)
|
13 |
|
14 |
# Set your OpenAI API key from environment variable
|
15 |
+
openai_api_key = os.getenv("OpenAI4oMini")
|
16 |
+
client = openai.OpenAI(api_key=openai_api_key) # Required for API calls
|
17 |
|
18 |
# Dropdown Options
|
19 |
car_companies = ["Select", "Toyota", "Honda", "Ford", "BMW", "Mercedes", "Audi", "Hyundai", "Kia", "Nissan"]
|
|
|
41 |
)
|
42 |
|
43 |
try:
|
44 |
+
response = client.ChatCompletion.create(
|
45 |
model="gpt-4o-mini",
|
46 |
messages=[
|
47 |
{"role": "system", "content": "You are an expert in car repair cost estimation."},
|