Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,7 +2,6 @@ import gradio as gr
|
|
| 2 |
import logging
|
| 3 |
import torch
|
| 4 |
from gpt4all import GPT4All
|
| 5 |
-
import spaces # Importing spaces
|
| 6 |
|
| 7 |
# Configure logging
|
| 8 |
logging.basicConfig(level=logging.INFO)
|
|
@@ -17,8 +16,7 @@ device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
|
| 17 |
if device.type == "cpu":
|
| 18 |
logging.warning("CUDA is not available. Using CPU for model execution.")
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
@spaces.GPU
|
| 22 |
def load_model():
|
| 23 |
try:
|
| 24 |
model = GPT4All(model_name_or_path)
|
|
@@ -28,7 +26,6 @@ def load_model():
|
|
| 28 |
logging.error(f"Failed to load model: {e}")
|
| 29 |
raise e
|
| 30 |
|
| 31 |
-
# Load the model
|
| 32 |
model = load_model()
|
| 33 |
|
| 34 |
def explain_advantages(electricity_consumption, car_type, vehicle_choice, range_km, daily_mileage, travel_mileage):
|
|
|
|
| 2 |
import logging
|
| 3 |
import torch
|
| 4 |
from gpt4all import GPT4All
|
|
|
|
| 5 |
|
| 6 |
# Configure logging
|
| 7 |
logging.basicConfig(level=logging.INFO)
|
|
|
|
| 16 |
if device.type == "cpu":
|
| 17 |
logging.warning("CUDA is not available. Using CPU for model execution.")
|
| 18 |
|
| 19 |
+
# Load the model
|
|
|
|
| 20 |
def load_model():
|
| 21 |
try:
|
| 22 |
model = GPT4All(model_name_or_path)
|
|
|
|
| 26 |
logging.error(f"Failed to load model: {e}")
|
| 27 |
raise e
|
| 28 |
|
|
|
|
| 29 |
model = load_model()
|
| 30 |
|
| 31 |
def explain_advantages(electricity_consumption, car_type, vehicle_choice, range_km, daily_mileage, travel_mileage):
|