Rerandaka commited on
Commit
bccfe08
·
verified ·
1 Parent(s): 87b51f6
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -15,14 +15,12 @@ def classify(text):
15
  predicted_class = torch.argmax(logits, dim=1).item()
16
  return str(predicted_class)
17
 
18
- # Use Blocks
19
  with gr.Blocks() as demo:
20
  txt_in = gr.Textbox(label="Enter text")
21
  txt_out = gr.Textbox(label="Prediction")
22
  btn = gr.Button("Classify")
23
  btn.click(classify, txt_in, txt_out)
24
 
25
- # Enable a predictable API endpoint
26
- demo.load(fn=classify, inputs=txt_in, outputs=txt_out, api_name="predict")
27
-
28
- demo.launch()
 
15
  predicted_class = torch.argmax(logits, dim=1).item()
16
  return str(predicted_class)
17
 
18
+ # Create Gradio interface
19
  with gr.Blocks() as demo:
20
  txt_in = gr.Textbox(label="Enter text")
21
  txt_out = gr.Textbox(label="Prediction")
22
  btn = gr.Button("Classify")
23
  btn.click(classify, txt_in, txt_out)
24
 
25
+ # Launch with API enabled
26
+ demo.launch()