sha1779 commited on
Commit
07a2f37
·
verified ·
1 Parent(s): 95575c8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -25
app.py CHANGED
@@ -1,8 +1,5 @@
1
  import gradio as gr
2
- from gradio_client import Client
3
-
4
-
5
-
6
 
7
  title = "RoyalGPT 7B Chatbot"
8
  description = """
@@ -15,30 +12,15 @@ examples=[
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
- {'prompt':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="/"
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)
 
1
  import gradio as gr
2
+ from gradio import Client # Correct import statement
 
 
 
3
 
4
  title = "RoyalGPT 7B Chatbot"
5
  description = """
 
12
  ['Explain the plot of Cinderella in a sentence.'],
13
  ['How many hours does it take a man to eat a Helicopter?'],
14
  ["Write a 100-word article on 'Benefits of Open-Source in AI research'"],
15
+ ]
 
16
 
17
  # Stream text
18
+ def predict(message, chatbot):
 
19
  client = Client("https://sha1779-royalgpt.hf.space/")
20
+ return client.predict({'prompt': message}) # Adjusted function call
 
 
 
 
 
 
 
 
 
 
 
 
21
 
22
  # Gradio Demo
23
+ with gr.Interface(predict, title=title, description=description, css=css, examples=examples) as demo: # Corrected gr.Blocks to gr.Interface
24
+ gr.ChatInterface(predict)
 
25
 
26
+ demo.launch(debug=True)