SailajaS commited on
Commit
87ecbe0
Β·
verified Β·
1 Parent(s): bb3939d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
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(fn=gradio_interface, inputs="text", outputs="text")
122
- gr_interface.launch()
 
 
 
 
 
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__":