Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -1,16 +1,25 @@
|
|
1 |
import os
|
2 |
import gradio as gr
|
|
|
3 |
|
4 |
MY_HF_TOKEN_KEY = os.environ["MY_HF_TOKEN_KEY"]
|
5 |
|
6 |
-
iface = gr.load(name="Ghana-NLP/Khaya-chat-bot",hf_token=MY_HF_TOKEN_KEY,src ='spaces')
|
|
|
|
|
7 |
with gr.Blocks() as demo:
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
with gr.Row():
|
9 |
-
output = gr.Text(label="Conversation")
|
10 |
with gr.Row():
|
11 |
-
prompt = gr.Text(label="Enter
|
12 |
btn = gr.Button("Chat")
|
13 |
-
btn.click(
|
14 |
|
15 |
if __name__ == "__main__":
|
16 |
demo.queue(max_size=20).launch()
|
|
|
1 |
import os
|
2 |
import gradio as gr
|
3 |
+
from gradio_client import Client
|
4 |
|
5 |
MY_HF_TOKEN_KEY = os.environ["MY_HF_TOKEN_KEY"]
|
6 |
|
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,src ='spaces')
|
9 |
+
|
10 |
with gr.Blocks() as demo:
|
11 |
+
title = gr.Markdown(
|
12 |
+
"""
|
13 |
+
# African Language Chatbot (Khaya)
|
14 |
+
SELECT YOUR LANGUAGE BELOW!
|
15 |
+
""")
|
16 |
+
language_selector = gr.Dropdown(["Twi","Dagbani","Ewe","Fante","Ga","Gurene","Kikuyu","Kimeru","Luo","Yoruba","Hausa","Swahili"],value="Twi", label="", info="LANGUAGE:")
|
17 |
with gr.Row():
|
18 |
+
output = gr.Text(label="Conversation:")
|
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()
|