Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,8 +1,5 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
from
|
| 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
|
| 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.
|
| 41 |
-
|
| 42 |
-
gr.ChatInterface(predict, title=title, description=description, css=css, examples=examples)
|
| 43 |
|
| 44 |
-
demo.
|
|
|
|
| 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)
|