Spaces:
Runtime error
Runtime error
ffreemt
commited on
Commit
·
ad51515
1
Parent(s):
66acbac
Update
Browse files
app.py
CHANGED
|
@@ -292,23 +292,12 @@ with gr.Blocks(
|
|
| 292 |
yield from bot_stream(chat_history, **config)
|
| 293 |
|
| 294 |
with gr.Accordion("🎈 Info", open=False):
|
| 295 |
-
poundkey = "#"
|
| 296 |
gr.Markdown(
|
| 297 |
dedent(
|
| 298 |
f"""
|
| 299 |
## {model_name.lower()}
|
| 300 |
|
| 301 |
-
* temperature range: .51 and up; higher temperature implies more
|
| 302 |
-
|
| 303 |
-
* Set `repetition_penalty` to 2.1 or higher for a chatty conversation (more unpredictable and undesirable output). Lower it to 1.1 or smaller if more focused anwsers are desired (for example for translations or fact-oriented queries).
|
| 304 |
-
|
| 305 |
-
* Smaller `top_k` probably will result in smoothier sentences.
|
| 306 |
-
(`top_k=0` is equivalent to `top_k` equal to very very big though.) Consult `transformers` documentation for more details.
|
| 307 |
-
|
| 308 |
-
* If you inadvertanyl messed up the parameters or the model, reset it in Advanced Options or reload the browser.
|
| 309 |
-
|
| 310 |
-
<p></p>
|
| 311 |
-
An api is available at, well, https://mikeee-qwen-7b-chat.hf.space/, e.g. in python
|
| 312 |
|
| 313 |
```python
|
| 314 |
from gradio_client import Client
|
|
@@ -316,19 +305,18 @@ with gr.Blocks(
|
|
| 316 |
client = Client("https://mikeee-qwen-7b-chat.hf.space/")
|
| 317 |
|
| 318 |
result = client.predict(
|
| 319 |
-
"你好!",
|
| 320 |
-
256,
|
| 321 |
-
1.2,
|
| 322 |
-
1.1,
|
| 323 |
-
0,
|
| 324 |
-
0.9,
|
| 325 |
-
"You are a help assistant",
|
| 326 |
-
None,
|
| 327 |
api_name="/api"
|
| 328 |
)
|
| 329 |
print(result)
|
| 330 |
```
|
| 331 |
-
|
| 332 |
or in javascript
|
| 333 |
```js
|
| 334 |
import {{ client }} from "@gradio/client";
|
|
@@ -337,12 +325,12 @@ with gr.Blocks(
|
|
| 337 |
const result = await app.predict("api", [...]);
|
| 338 |
console.log(result.data);
|
| 339 |
```
|
| 340 |
-
Check documentation and examples by clicking `Use via API` at the very bottom of
|
| 341 |
|
| 342 |
<p></p>
|
| 343 |
Most examples are meant for another model.
|
| 344 |
You probably should try to test
|
| 345 |
-
some related prompts."""
|
| 346 |
),
|
| 347 |
elem_classes="xsmall",
|
| 348 |
)
|
|
|
|
| 292 |
yield from bot_stream(chat_history, **config)
|
| 293 |
|
| 294 |
with gr.Accordion("🎈 Info", open=False):
|
|
|
|
| 295 |
gr.Markdown(
|
| 296 |
dedent(
|
| 297 |
f"""
|
| 298 |
## {model_name.lower()}
|
| 299 |
|
| 300 |
+
* temperature range: .51 and up; higher temperature implies more randomness. Suggested temperature for chatting and creative writing is around 1.1 while it should be set to 0.51-1.0 for summarizing https://mikeee-qwen-7b-chat.hf.space/ that can be queried, e.g. in python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 301 |
|
| 302 |
```python
|
| 303 |
from gradio_client import Client
|
|
|
|
| 305 |
client = Client("https://mikeee-qwen-7b-chat.hf.space/")
|
| 306 |
|
| 307 |
result = client.predict(
|
| 308 |
+
"你好!", # user prompt
|
| 309 |
+
256, # max_new_tokens
|
| 310 |
+
1.2, # temperature
|
| 311 |
+
1.1, # repetition_penalty
|
| 312 |
+
0, # top_k
|
| 313 |
+
0.9, # top_p
|
| 314 |
+
"You are a help assistant", # system_prompt
|
| 315 |
+
None, # history
|
| 316 |
api_name="/api"
|
| 317 |
)
|
| 318 |
print(result)
|
| 319 |
```
|
|
|
|
| 320 |
or in javascript
|
| 321 |
```js
|
| 322 |
import {{ client }} from "@gradio/client";
|
|
|
|
| 325 |
const result = await app.predict("api", [...]);
|
| 326 |
console.log(result.data);
|
| 327 |
```
|
| 328 |
+
Check documentation and examples by clicking `Use via API` at the very bottom of [https://huggingface.co/spaces/mikeee/qwen-7b-chat](https://huggingface.co/spaces/mikeee/qwen-7b-chat).
|
| 329 |
|
| 330 |
<p></p>
|
| 331 |
Most examples are meant for another model.
|
| 332 |
You probably should try to test
|
| 333 |
+
some related prompts. System prompt can be changed in Advaned Options as well."""
|
| 334 |
),
|
| 335 |
elem_classes="xsmall",
|
| 336 |
)
|