ierhon commited on
Commit
699ee01
1 Parent(s): dd59e8e

Add if __name__ == "__main__"

Browse files

After using git clone now chatbot_constructor.py can be imported

Files changed (1) hide show
  1. app.py → constructor.py +9 -8
app.py → constructor.py RENAMED
@@ -71,11 +71,12 @@ def train(message: str, epochs: int, learning_rate: float, emb_size: int, inp_le
71
  keras.backend.clear_session()
72
  return responses[np.argmax(prediction)]
73
 
74
- iface = gr.Interface(fn=train, inputs=["text",
75
- gr.inputs.Slider(1, 64, default=32, step=1, label="Epochs"),
76
- gr.inputs.Slider(0.00000001, 0.1, default=0.001, step=0.00000001, label="Learning rate"),
77
- gr.inputs.Slider(1, 256, default=100, step=1, label="Embedding size"),
78
- gr.inputs.Slider(1, 128, default=16, step=1, label="Input Length"),
79
- "text"],
80
- outputs="text")
81
- iface.launch()
 
 
71
  keras.backend.clear_session()
72
  return responses[np.argmax(prediction)]
73
 
74
+ if __name__ == "__main__":
75
+ iface = gr.Interface(fn=train, inputs=["text",
76
+ gr.inputs.Slider(1, 64, default=32, step=1, label="Epochs"),
77
+ gr.inputs.Slider(0.00000001, 0.1, default=0.001, step=0.00000001, label="Learning rate"),
78
+ gr.inputs.Slider(1, 256, default=100, step=1, label="Embedding size"),
79
+ gr.inputs.Slider(1, 128, default=16, step=1, label="Input Length"),
80
+ "text"],
81
+ outputs="text")
82
+ iface.launch()