Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -71,7 +71,12 @@ def explain_advantages(electricity_consumption, car_type, vehicle_choice, range_
|
|
| 71 |
repeat_penalty=1.0
|
| 72 |
)
|
| 73 |
logging.info("Model generation successful.")
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
except Exception as e:
|
| 76 |
logging.error(f"Error during model generation: {e}")
|
| 77 |
return f"An error occurred while generating the response: {e}"
|
|
@@ -87,7 +92,7 @@ iface = gr.Interface(
|
|
| 87 |
gr.Number(label="Estimated Daily Mileage (km)", value=50.0),
|
| 88 |
gr.Number(label="Mileage from Travels (km/year)", value=1000.0),
|
| 89 |
],
|
| 90 |
-
outputs=gr.Textbox(label="Advantages of Going Fully Electric"),
|
| 91 |
title="Explaining the Advantages of Going Fully Electric",
|
| 92 |
description="Enter your vehicle's parameters to understand the benefits of switching to a fully electric vehicle.",
|
| 93 |
)
|
|
|
|
| 71 |
repeat_penalty=1.0
|
| 72 |
)
|
| 73 |
logging.info("Model generation successful.")
|
| 74 |
+
|
| 75 |
+
# Check if the generated text is empty
|
| 76 |
+
if not generated_text:
|
| 77 |
+
return "Model generation failed: No output text generated."
|
| 78 |
+
else:
|
| 79 |
+
return generated_text
|
| 80 |
except Exception as e:
|
| 81 |
logging.error(f"Error during model generation: {e}")
|
| 82 |
return f"An error occurred while generating the response: {e}"
|
|
|
|
| 92 |
gr.Number(label="Estimated Daily Mileage (km)", value=50.0),
|
| 93 |
gr.Number(label="Mileage from Travels (km/year)", value=1000.0),
|
| 94 |
],
|
| 95 |
+
outputs=gr.Textbox(label="Advantages of Going Fully Electric", lines=10),
|
| 96 |
title="Explaining the Advantages of Going Fully Electric",
|
| 97 |
description="Enter your vehicle's parameters to understand the benefits of switching to a fully electric vehicle.",
|
| 98 |
)
|