azunre commited on
Commit
801ecb8
·
verified ·
1 Parent(s): b2a05bf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -1
app.py CHANGED
@@ -7,6 +7,10 @@ MY_HF_TOKEN_KEY = os.environ["MY_HF_TOKEN_KEY"]
7
  #iface = gr.load(name="Ghana-NLP/Khaya-chat-bot",hf_token=MY_HF_TOKEN_KEY,src ='spaces')
8
  client = Client("Ghana-NLP/Khaya-chat-bot",hf_token=MY_HF_TOKEN_KEY)
9
 
 
 
 
 
10
  with gr.Blocks() as demo:
11
  title = gr.Markdown(
12
  """
@@ -19,7 +23,7 @@ with gr.Blocks() as demo:
19
  with gr.Row():
20
  prompt = gr.Text(label="Enter Text In Your Local Language:")
21
  btn = gr.Button("Chat")
22
- btn.click(client.predict, inputs=[prompt,language_selector], outputs=[output])
23
 
24
  if __name__ == "__main__":
25
  demo.queue(max_size=20).launch()
 
7
  #iface = gr.load(name="Ghana-NLP/Khaya-chat-bot",hf_token=MY_HF_TOKEN_KEY,src ='spaces')
8
  client = Client("Ghana-NLP/Khaya-chat-bot",hf_token=MY_HF_TOKEN_KEY)
9
 
10
+ def generate(prompt,language):
11
+ output = client.predict(prompt,language)
12
+ return output
13
+
14
  with gr.Blocks() as demo:
15
  title = gr.Markdown(
16
  """
 
23
  with gr.Row():
24
  prompt = gr.Text(label="Enter Text In Your Local Language:")
25
  btn = gr.Button("Chat")
26
+ btn.click(generate, inputs=[prompt,language_selector], outputs=[output])
27
 
28
  if __name__ == "__main__":
29
  demo.queue(max_size=20).launch()