sha1779 commited on
Commit
7b23d6d
·
verified ·
1 Parent(s): 85657e7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -2
app.py CHANGED
@@ -1,3 +1,44 @@
1
  import gradio as gr
2
- demo = gr.Interface(api_name="https://sha1779-royalgpt.hf.space/", inputs="image", outputs="label")
3
- demo.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import gradio as gr
2
+ from gradio_client import Client
3
+
4
+
5
+
6
+
7
+ title = "RoyalGPT 7B Chatbot"
8
+ description = """
9
+ This Space demonstrates model [RoyalGPT-7B-chat-hf] by CCL, a Llama 2 model with 7B parameters fine-tuned for Bangla chat instructions.
10
+ """
11
+ css = """.toast-wrap { display: none !important } """
12
+ examples=[
13
+ ['Hello there! How are you doing?'],
14
+ ['Can you explain to me briefly what is Python programming language?'],
15
+ ['Explain the plot of Cinderella in a sentence.'],
16
+ ['How many hours does it take a man to eat a Helicopter?'],
17
+ ["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
18
+ ]
19
+
20
+
21
+ # Stream text
22
+ def predict(message, chatbot, system_prompt="", temperature=0.9, max_new_tokens=4096):
23
+
24
+ client = Client("https://sha1779-royalgpt.hf.space/")
25
+ return client.predict(
26
+ message, # str in 'Message' Textbox component
27
+ system_prompt, # str in 'Optional system prompt' Textbox component
28
+ temperature, # int | float (numeric value between 0.0 and 1.0)
29
+ max_new_tokens, # int | float (numeric value between 0 and 4096)
30
+ 0.3, # int | float (numeric value between 0.0 and 1)
31
+ 1, # int | float (numeric value between 1.0 and 2.0)
32
+ api_name="/chat"
33
+ )
34
+
35
+
36
+
37
+
38
+
39
+ # Gradio Demo
40
+ with gr.Blocks(theme=gr.themes.Base()) as demo:
41
+
42
+ gr.ChatInterface(predict, title=title, description=description, css=css, examples=examples)
43
+
44
+ demo.queue().launch(debug=True)