create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from llama_cpp import Llama
|
2 |
+
import gradio as gr
|
3 |
+
import time
|
4 |
+
|
5 |
+
llm = Llama(model_path="zephyr-7B-beta-GGUF/zephyr-7b-beta.Q4_K_M.gguf")
|
6 |
+
|
7 |
+
def predict(prompt,history):
|
8 |
+
output = llm(prompt)
|
9 |
+
response = output['choices'][0]['text']
|
10 |
+
for i in range(len(response)):
|
11 |
+
time.sleep(0.05)
|
12 |
+
yield response[:i+1]
|
13 |
+
|
14 |
+
gr.ChatInterface(predict).queue().launch()
|