Spaces:
Sleeping
Sleeping
xiaoheiqaq
commited on
Commit
•
1e11e19
1
Parent(s):
30586e7
Update chat layout
Browse files- .gitignore +2 -1
- app.py +5 -2
.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1 |
-
.venv
|
|
|
|
1 |
+
.venv
|
2 |
+
.env
|
app.py
CHANGED
@@ -1,6 +1,8 @@
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import requests
|
|
|
|
|
4 |
|
5 |
url = os.getenv('BACKEND_URL')
|
6 |
username = os.getenv('USERNAME')
|
@@ -30,9 +32,10 @@ def update_system_prompt(new_content):
|
|
30 |
global system_prompt_text
|
31 |
system_prompt_text = new_content
|
32 |
|
33 |
-
with gr.Blocks() as demo:
|
34 |
gr.ChatInterface(
|
35 |
predict,
|
|
|
36 |
examples=["我心情好差呜呜",
|
37 |
"工作之余,你有什么爱好或兴趣吗?",
|
38 |
"谁创造了你?",
|
@@ -45,7 +48,7 @@ with gr.Blocks() as demo:
|
|
45 |
"你有更新过吗?"]
|
46 |
)
|
47 |
system_prompt = gr.Textbox(value=system_prompt_text, info="System Message:", placeholder="你是Emi",
|
48 |
-
interactive=True, lines=
|
49 |
system_prompt.change(
|
50 |
fn=update_system_prompt, inputs=system_prompt)
|
51 |
|
|
|
1 |
import gradio as gr
|
2 |
import os
|
3 |
import requests
|
4 |
+
import dotenv
|
5 |
+
dotenv.load_dotenv()
|
6 |
|
7 |
url = os.getenv('BACKEND_URL')
|
8 |
username = os.getenv('USERNAME')
|
|
|
32 |
global system_prompt_text
|
33 |
system_prompt_text = new_content
|
34 |
|
35 |
+
with gr.Blocks(fill_height=True) as demo:
|
36 |
gr.ChatInterface(
|
37 |
predict,
|
38 |
+
cache_examples=False,
|
39 |
examples=["我心情好差呜呜",
|
40 |
"工作之余,你有什么爱好或兴趣吗?",
|
41 |
"谁创造了你?",
|
|
|
48 |
"你有更新过吗?"]
|
49 |
)
|
50 |
system_prompt = gr.Textbox(value=system_prompt_text, info="System Message:", placeholder="你是Emi",
|
51 |
+
interactive=True, lines=5)
|
52 |
system_prompt.change(
|
53 |
fn=update_system_prompt, inputs=system_prompt)
|
54 |
|