Update app.py
Browse files
app.py
CHANGED
|
@@ -7,7 +7,19 @@ def chat(message, history):
|
|
| 7 |
if not message:
|
| 8 |
return ""
|
| 9 |
|
| 10 |
-
|
| 11 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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 |
|
|
|