Update app.py
Browse files
app.py
CHANGED
|
@@ -55,7 +55,7 @@ for col in required_columns:
|
|
| 55 |
raise Exception(f"β Column '{col}' is missing from the dataset!")
|
| 56 |
|
| 57 |
# β
Convert "Case Problem" column to lowercase for consistency
|
| 58 |
-
df["Case Problem"] = df["Case Problem"].str.lower()
|
| 59 |
|
| 60 |
# β
Encode categorical variables
|
| 61 |
encoder = LabelEncoder()
|
|
@@ -118,8 +118,13 @@ def gradio_interface(case_problem):
|
|
| 118 |
# β
Start both API & Gradio
|
| 119 |
def start_app():
|
| 120 |
""" Start API and Gradio Interface """
|
| 121 |
-
gr_interface = gr.Interface(
|
| 122 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|
| 124 |
|
| 125 |
if __name__ == "__main__":
|
|
|
|
| 55 |
raise Exception(f"β Column '{col}' is missing from the dataset!")
|
| 56 |
|
| 57 |
# β
Convert "Case Problem" column to lowercase for consistency
|
| 58 |
+
df["Case Problem"] = df["Case Problem"].astype(str).str.lower()
|
| 59 |
|
| 60 |
# β
Encode categorical variables
|
| 61 |
encoder = LabelEncoder()
|
|
|
|
| 118 |
# β
Start both API & Gradio
|
| 119 |
def start_app():
|
| 120 |
""" Start API and Gradio Interface """
|
| 121 |
+
gr_interface = gr.Interface(
|
| 122 |
+
fn=gradio_interface,
|
| 123 |
+
inputs="text",
|
| 124 |
+
outputs="text",
|
| 125 |
+
live=True # β
Ensures Gradio UI updates properly
|
| 126 |
+
)
|
| 127 |
+
gr_interface.launch(share=True) # β
Makes app accessible externally
|
| 128 |
uvicorn.run(app, host="0.0.0.0", port=8000)
|
| 129 |
|
| 130 |
if __name__ == "__main__":
|