Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
File size: 1,363 Bytes
999dd31 da64ad8 f087c51 da64ad8 999dd31 b6ad8bc 8893347 fea87b1 16378c8 fea87b1 16378c8 08d14ec 129570f fea87b1 2e0c7b8 509dc90 2e0c7b8 881a9e8 da64ad8 e867a66 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
import os
import gradio as gr
from gradio_client import Client
MY_HF_TOKEN_KEY = os.environ["MY_HF_TOKEN_KEY"]
#client = Client("Ghana-NLP/Khaya-chat-backend",hf_token=MY_HF_TOKEN_KEY)
client = Client("Ghana-NLP/KhayaAIAssistant",hf_token=MY_HF_TOKEN_KEY)
def generate(prompt,history,language):
#print(history)
output = client.predict(prompt,language)
#print(output)
history.append([prompt,output])
return output
with gr.Blocks(fill_height=True) as demo:
title = gr.Markdown(
"""
# African Language Chatbot (Khaya)
SELECT YOUR LANGUAGE BELOW!
Based on the <a href="https://translation.ghananlp.org/">Khaya AI</a> and <a href="https://lesan.ai/">Lesan AI</a>. Lesan is used for <b>Amharic</b> and <b>Tigrinya</b>.
NOTE - Conversations collected to train Native LLMs. Want a private chat? Contact us for the code.
""")
language_selector = gr.Dropdown(["Amharic","Twi","Dagbani","Ewe","Ga","Gurene","Fante","Hausa", "Kikuyu", "Kimeru", "Luo","Shona","Swahili","Tigrinya","Yoruba"],value="Twi",label="Choose Language! (default is Twi)", info="Language:")
main_block = gr.ChatInterface(fn=generate, additional_inputs = language_selector,
description = 'Select an African language above and type messages below in selected language')
if __name__ == "__main__":
demo.queue(max_size=20).launch() |