Bhaddy392 commited on
Commit
10b4484
·
verified ·
1 Parent(s): 569f3e3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -3
app.py CHANGED
@@ -7,7 +7,19 @@ def chat(message, history):
7
  if not message:
8
  return ""
9
 
10
- response = pipe(message, max_length=100, pad_token_id=50256)
11
- return response[0]["generated_text"]
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
- gr.ChatInterface(fn=chat).launch()
 
7
  if not message:
8
  return ""
9
 
10
+ prompt = f"User: {message}\nAI Queen:"
11
+ response = pipe(prompt, max_length=100, pad_token_id=50256)
12
+ text = response[0]["generated_text"]
13
+
14
+ if "AI Queen:" in text:
15
+ text = text.split("AI Queen:")[-1].strip()
16
+
17
+ return text
18
+
19
+ with gr.Blocks(title="AI Queen") as demo:
20
+ gr.Markdown("# AI Queen")
21
+ gr.Markdown("Your intelligent and majestic assistant")
22
+ gr.ChatInterface(fn=chat)
23
+
24
+ demo.launch()
25