File size: 1,043 Bytes
85657e7
07a2f37
7b23d6d
 
 
 
 
 
 
 
 
 
 
 
07a2f37
7b23d6d
 
07a2f37
aa41da7
07a2f37
7b23d6d
 
07a2f37
 
7b23d6d
07a2f37
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
import gradio as gr
from gradio import Client  # Correct import statement

title = "RoyalGPT 7B Chatbot"
description = """
This Space demonstrates model [RoyalGPT-7B-chat-hf] by CCL, a Llama 2 model with 7B parameters fine-tuned for Bangla chat instructions. 
"""
css = """.toast-wrap { display: none !important } """
examples=[
    ['Hello there! How are you doing?'],
    ['Can you explain to me briefly what is Python programming language?'],
    ['Explain the plot of Cinderella in a sentence.'],
    ['How many hours does it take a man to eat a Helicopter?'],
    ["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
]

# Stream text
def predict(message, chatbot):
    client = Client("https://sha1779-royalgpt.hf.space/")
    return client.predict({'prompt': message})  # Adjusted function call

# Gradio Demo 
with gr.Interface(predict, title=title, description=description, css=css, examples=examples) as demo:  # Corrected gr.Blocks to gr.Interface
    gr.ChatInterface(predict) 
        
demo.launch(debug=True)